Javid Jamae
Javid Jamae

Reputation: 9029

Paginated, randomized search result, without clumping

For our RoR-based e-commerce site, we are showing a paginated search result of products. Even when randomized, this list frequently has several products of the same brand clumped together. We want a search result that is "de-clumped" such that products of the same brand don't appear near one another.

For example, if I have thousands of products that belong to 50 brands and I'm showing fewer than 50 products on the page, it shouldn't show more than one product per brand on that page (or preferably some configurable maximum). I would have to maintain a "seed" value of some sort to pass in as the user advances from page to page so that I can recreate the search order.

What algorithm or strategy can I use to accomplish this de-clumped/randomized result?

Upvotes: 0

Views: 123

Answers (1)

Roman Pokrovskij
Roman Pokrovskij

Reputation: 9776

I could describe the strategy that virtocommerce propose, it woroks on catalog level. Here is possible to group similar "variations" to "products". Then variations could be marked as not visible during search or/and in the e-store main catalog when products are visible and could inherit some "variations" keywords to be searchable. The variations are still purchasable but only from the product page.

Upvotes: 2

Related Questions