Ttypesense- Implementing contextual Query Suggestions

39 Views Asked by At

I am using typesence to build contextual query suggestions but there is not enough documentation for its query suggestions features.

I have implemented popular query suggestions using this page from typesence but want to show query suggestions for different product categories. Something like:

enter image description here

1

There are 1 best solutions below

0
yco On

Depending on your use-case and data you can either perform a multi-search (aka federated search) on your different popular queries collections or use a group_by attribute in your query-suggestion query.

In the former (federated) you will have to use the results from each collection to create your categorized suggestions.

In the latter (groupping), the results will be located in the groupped_hits attribute instead of hits indexed by the groupping attribute value.