Google or Amazon-like keyword autofill in Algolia

How do I achieve keyword-based auto-fill suggestions in Algolia that look something like Amazon or Google?

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.

+5
source share
2 answers

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 attribute
  • customRanking 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).

+9
source

I have not used algolia, but google returns https://www.algolia.com/doc/search/auto-complete#introduction

-2
source

All Articles