I tried to create autocomplete based on several attributes of an Algolia document, however its purpose does not really help me when filling out a phrase, but it directs me to choose a specific product.
If you want to offer some search queries instead of products / objects, you can create an index in your search logs. You can use the Algolia Analytics API + popular search queries to get them if you do not already have them.
Then you can save them in the popular_searches index:
{ "value": "my popular search", "count": 42 // the search frequency }
And configure:
attributesToIndex to set the value attributecustomRanking use desc(count) as an attribute that reflects popularity
As the saying goes, you should be aware that such a popular autocomplete search can be difficult to set up to access Amazon / Google UX:
- make sure the search terms you use are quite popular (remove the low frequencies).
- make sure your search queries actually retrieve the results β to ensure that your users get the results when you select from the drop-down menu (you can request your product index at build time)
- make sure your searches do not contain SPAM (itβs super easy to make a script by bombarding your API to make spam search very popular, so itβs included in the drop-down menu)
- make sure your search terms do not include offensive / bad words :) (Even Google has a hard time)
TL; DR; If you have a choice, pre-copy the search list from your products / objects instead of using query logs. It will be safer and easier to maintain (I'm sure what Amazon is doing).
redox source share