#community-help

Displaying Preview of Variations in Typesense Results

TLDR John asks how to display previews of product variations with deduplication. Jason recommends using group_by and group_limit parameters.

Powered by Struct AI

1

Apr 28, 2023 (7 months ago)
John
Photo of md5-894e524356146cb346abbb1f595710f0
John
04:02 PM
Hi Everyone,

New to typesense, so my apologies if my question seems elementary.

Our ecomm store has quite a few products that have variations (sizes, colors, etc.). When using deduplication to reduce the search result to only display 1 of the variations.

Is it possible to efficiently display some type of preview of the variations of that item that are not shown (example – image thumbnail, or icon depicting the color)? If so, how?

Thank you!
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:13 PM
Yup, you want to use the group_by search parameter to return say X items per group (using the group_limit parameter). Then in the UI, you can display the first item in the group to the user with product title, etc and then use just the image url attribute from the other records within the group, to render a small thumbnail for each
John
Photo of md5-894e524356146cb346abbb1f595710f0
John
05:14 PM
Thank you!

1