#community-help

Ecommerce Search Engine with User-added Products

TLDR Max seeks advice on handling a boolean field showing if a product is already in a user's cart for an ecommerce search engine. Kishore Nallan suggests waiting for the future "join" feature to allow merging separate indexes at query time.

Powered by Struct AI

2

1

Mar 31, 2023 (8 months ago)
Max
Photo of md5-ac5d64b63e48fd1a3cf936c3e2221a2c
Max
09:51 AM
Hi team, I have an ecommerce usecase, a classic ecommerce search engine I would say. So I have an index with all information for a product (title, description, image, price, stock, etc.). However, we have an additional feature where an user can see if he already has added a product from his search results into his shopping cart. This feature can be done on our front easily just by having a boolean "already_added" within the document fields. The problem is that we would need to have this boolean for each user (+30k users), and for each product (1M products). Eventhough putting everything into a single index would not affect performances, it would be a complicated mess to handle. I was thinking to have a global product index on one side, and on the other side, one "user personalized" index containing all products added for each user. Each time a user adds a product to his shopping cart, we update the user personalized index.
I would then, somehow (😇), do a multi index query or multi query to check if, for the current user, the products in his search results have already been added to shopping cart by adding a boolean. Is this possible ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:03 AM
👋 What you are describing is a need for a "join" feature. This way you can keep the user preference and product attributes as separate collections and then just join them at query time.

Good new: we're acutely aware of this need and have kicked off work to implement this feature. However, it's going to take some time before I can share a build for you to test it, given the scope and depth of the changes involved.

1

10:04
Kishore Nallan
10:04 AM
"going to take some time" == "month or two from now"

1

Max
Photo of md5-ac5d64b63e48fd1a3cf936c3e2221a2c
Max
10:10 AM
Hi Kishore Nallan, well a few months is good news ! Happy to know this feature is in your backlog. In the meanwhile, I think I can just have the "classic ecommerce" index on one side, and on the other side a "user personnalized" index where a user_id has a list of product_id.
With a multi search query I can have the ecommerce products and a list of products already added for a specific user. I will be able to add a display to a product if this product within the query results has already been added. But do you confirm that I cannot exclude products already added (query1) from global product results (query 2) ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:12 AM
Only if you can do 2 queries, first to fetch the IDs and then to exclude via another query.
Max
Photo of md5-ac5d64b63e48fd1a3cf936c3e2221a2c
Max
10:14 AM
Ok I am trying this

Once the JOIN feature is live on the engine, we will be able to do it with only one query ? My use case here is like a SQL LEFT OUTER JOIN
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:17 AM
Yes, you will query on product collection and then pull necessary fields from the "user_features" collection by joining on the product_id field which will be common to both collection.

1

Max
Photo of md5-ac5d64b63e48fd1a3cf936c3e2221a2c
Max
10:38 AM
To avoid having to change structure when the JOIN feature is live, are you able to validate my current one ?

Screen 1 is a product document from product index
Screen 2 is a user document from user_feature index

With this structure, will I be able to exclude all product ids (added_products in user document) from query results in the product index ? All the added product ids from a user document IS EQUAL to a product index document id
Image 1 for To avoid having to change structure when the JOIN feature is live, are you able to validate my current one ?

Screen 1 is a product document from product index
Screen 2 is a user document from user_feature index

With this structure, will I be able to exclude all product ids (added_products in user document) from query results in the product index ? All the added product ids from a user document IS EQUAL to a product index document idImage 2 for To avoid having to change structure when the JOIN feature is live, are you able to validate my current one ?

Screen 1 is a product document from product index
Screen 2 is a user document from user_feature index

With this structure, will I be able to exclude all product ids (added_products in user document) from query results in the product index ? All the added product ids from a user document IS EQUAL to a product index document id
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:42 AM
The user features collection should be just user_id, document_id

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

User-Specific Tagging and Filtering in UI

bnfd asked for the best way to create user-specific tags available on the UI. Jason suggested using personalized filters and creating a separate collection for each user's movies. The duo clarified the use of 'tags' in schemas and the refinementList widget in instantsearch. They also discussed various approaches to import and search large document collections.

1

46
29mo
Solved

Including All Individual Documents in a Group in Typesense

Magnus was uncertain how to include all documents within a group in Typesense, and specifically asked about ecommerce product cards. Jason published a new version of Typesense Instantsearch Adapter and advised storing all variant information for a product on each document. Magnus confirmed this as a viable solution.

9
18mo
Solved

Discussions on Typesense, Collections, and Dynamic Fields

Tugay shares plans to use Typesense for their SaaS platform and asks about collection sizes and sharding. Jason clarifies Typesense's capabilities and shares a beta feature. They discuss using unique collections per customer and new improvements. Kishore Nallan and Gabe comment on threading and data protection respectively.

3

45
35mo
Solved

Implementation and Optimization of 'Similar Products' Feature

Stefan is considering using "curation" for pre-calculating similar products. Kishore Nallan suggests using preset API, but Stefan raised an issue with sorting based on non-stored values. The issue remains open for resolution.

3

26
18mo

Discussing Document Indexing Speeds and Typesense Features

Thomas asks about the speed of indexing and associated factors. The conversation reveals that larger batch sizes and NVMe disk usage can improve speed, but the index size is limited by RAM. Jason shares plans on supporting nested fields, and they explore a solution for products in multiple categories and catalogs.

5

63
23mo
Solved