Implementing "Popular Searches" and "Search History" for Autocomplete

TLDR David asked about implementing popular searches and search history features. Kishore Nallan explained it entails gathering and aggregating search queries, sorting by popularity, with plans to simplify this process in Typesense.

Powered by Struct AI


Dec 12, 2022 (12 months ago)
Photo of md5-07c4f1bfa85fc4a2759ba7302f0b86da
10:11 AM
Is pointers how to implement "popular searches" and "Search history" for a autocomplete/search as you type experience?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:09 AM
The primary task is gathering all search queries into a single place. Then you have to aggregate them like this:

query      | count
nike shoe  |  20
adidas     | 10 

Then treat the count as a popularity field and use it in sort_by clause.
Kishore Nallan
11:10 AM
In future we plan to make this easier by aggregating this query dataset within Typesense.