Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google or Amazon-like autocomplete keywords suggestion in Algolia

How do I achieve a keyword based autocomplete suggestions in Algolia similar to something like Amazon or Google?

I attempted building the autocomplete based on multiple attributes of an Algolia document, however its purpose does not really help me at completing a phrase but it directs me at selecting a specific product.

like image 943
GiamPy Avatar asked Jun 22 '16 09:06

GiamPy


People also ask

How would you implement autocomplete suggestions while typing?

Click Search features from the menu on the left and then click the Autocomplete tab. Click on the slider to set Enable autocomplete to On. It can take up to 2-4 days for autocompletions tailored to your search engine to start appearing.

Is Algolia the best?

Algolia is a great internal search engine tool for big eCommerce platforms, it is one of the best tools in the market. The available features and configurations help the product manager to relevant search results to their customers. Best thing is the results are instant once the integration is done.

What is algoliasearch?

Algolia is an AI-powered search and discovery platform for dynamic experiences that helps businesses maximize the speed of search and discovery, while solving the pain of relevance tuning through AI. Accessing the right content or products on websites and apps has never been faster or more intuitive.

How do recommended searches work?

Autocomplete predictions reflect real searches that have been done on Google. To determine what predictions to show, our systems look for common queries that match what someone starts to enter into the search box but also consider: The language of the query. The location a query is coming from.


1 Answers

I attempted building the autocomplete based on multiple attributes of an Algolia document, however its purpose does not really help me at completing a phrase but it directs me at selecting a specific product.

If you want to suggest some searches instead of products/objects you can build an index with your searches logs. You can use Algolia's Analytics API + top searches endpoint to get them if you don't have them yet.

You could then store them in a popular_searches index like that:

{
  "value": "my popular search",
  "count": 42 // the search frequency
}

And configure:

  • searchableAttribute to target the value attribute
  • customRanking to use desc(count) as the attribute reflecting the popularity

That being said, you should know that such popular searches autocomplete can be super complex to setup to reach the UX of Amazon/Google:

  • make sure that the searches you use are popular enough (remove low frequencies)
  • make sure the searches you use are actually retrieving results -> to ensure your users will get results while selecting it from the dropdown menu (you can query your product index at build-time)
  • make sure your searches are not containing SPAM (super easy to do a script bombarding your API to make a spam search very popular so it goes in your dropdown menu)
  • make sure your searches don't include offensive/bad words :) (Even google has a hard time with that)

tldr; If you have choice, precompute a list of searches from your products/objects instead of using your query logs :) It will be safer & easier to maintain (I'm pretty sure that's what Amazon do).

like image 153
redox Avatar answered Nov 02 '22 23:11

redox