Equitable Distribution of Suppliers in Ecommerce Platform
TLDR Max has a problem with pagination, distribution, and grouping in an ecommerce use case. Jason suggests using "group_by" but notes that dynamic group sizes are not possible.
Mar 13, 2023 (7 months ago)
Until migrating to Typesense, here is what we did :
1. We calculate several scores for a product based on metrics like : its rating, its competitiveness, its order growth, is the supplier reactive, and so on, to have a global score.
2. This global score is used to sort products, to propose best scored products to clients according to their search queries.
3. For each search query, we find products that can match from every supplier concerned by the query. Then we distribute each product on a 20 products page where each supplier matched can have maximum 3 products displayed per page. All results are sorted by their product_score.
I am currently trying to reproduce this behavior in Typesense with the grouping parameters and the pagination parameters. I use a small dataset of 9946 products for tests.
My problem is that for a global query, I only find 40 documents out of 9946. With pages of 20 products, the third page is empty (big problem). I should have approximately 500 pages available, with maximum 3 products, for each supplier, per page of 20 products.
1. Am I doing something wrong or is there a parameter that I misunderstood ?
2. If the supplier distribution is not equitable, e.g supplier A have 9900 products in the results, and supplier B has 46, does the grouping parameters allow to have 10 products for supplier A and B on the first 4 pages, then the 5th page has 14 products of supplier A and 6 products of supplier B, and finally all remaining pages have supplier A products
3. More generally, this business rule is a common rule for a ecommerce platform with multiple suppliers proposing their products. Is there a better way to handle an equitable distribution ?
I give the supplier repartition of my test dataset and the query screenshot in the thread
2: 45, 3416: 50, 3802: 500, 3904: 107, 4245: 500, 4286: 500, 4323: 73, 4659: 500, 4675: 64, 4696: 164, 4767: 84, 4825: 49, 5244: 500, 5250: 500, 5254: 500, 5258: 500, 5361: 24, 5370: 210}
foundparameter in a group query counts the number of groups, not the number of documents within each group
grouped_hitsin the response, you’ll see 3 documents per supplier
group_byis indeed the parameter you need to build this functionality of only returning X results (
group_limit) for a given attribute (in your case
Mar 14, 2023 (7 months ago)
Can you explain why starting at page 15 I do not have any results ?
Is it possible to base pagination on items within the group whereas the group itself ?
Do you have any suggestion/use case that would help me with the third and last question in the initial message of this thread ?
group_by would be the best way to achieve what you’re looking to do
20 / Xevaluates to
For instance, imagine a search query with the following (non realistic) results :
Supplier A : 100 documents
Supplier B : 100 documents
Supplier C : 100 documents
Supplier D : 100 documents
Supplier E : 100 documents
My use case needs the following rule :
Maximum 3 products per supplier on each page (20 products per page)
So the results should follow this repartition:
Page 1 : 4 products for each supplier
Page 2 : 4 products for each supplier
Page 3 : 4 products for each supplier
1. Do the query without a group_by, but facet on the supplier_id, which will give you the total number of suppliers.
2. In the next query, based the total number of suppliers obtained from query 1, set the value of group_limit dynamically
Indexed 2786 threads (79% resolved)
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.
Moving from Algolia to Typesense: Questions and Answers
Juan sought advice from Kishore Nallan about moving from Algolia to Typesense, handling MultiSearch, setting parameters, checking imported documents, and a specific syntax query.
Utilizing Vector Search and Word Embeddings for Comprehensive Search in Typesense
Bill sought clarification on using vector search with multiple word embeddings in Typesense and using them instead of OpenAI's embedding. Kishore Nallan and Jason informed him that their development version 0.25 supports open source embedding models. They also resolved Bill's concerns regarding search performance, language support, and limitations in the search parameters.
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.
Typesense Ecommerce Storefront Showcase Discussion
Mica discussed enhancements and filters for an ecommerce storefront using Typesense. Jason offered resources on filters and handling facets count issues reported by Claudiu. Jason also implemented a solution to fix the problem.