Try our conversational search powered by Generative AI!

AutoComplete only returns editor added or statistical result



I am trying to implement a typeahead(autocomplete) functionality using Optimizely Find.

The results are a bit confusing, as I am only getting strings that I manually add in the CMS editor, or statistical results, which are strings that have been used previously and had returned at least a page. The previous solution used to generate results by matching the user query against the text from all the indexed pages in the project. Is there a way I can achieve that with this setup?

The endpoint I am using is localhost:<port>/find_v2/_autocomplete?prefix=<query>

a new query that doesn t return anything:  ->

a query returns hit which is added by CMS editor 

Any input would be appreciated

Dec 23, 2022 10:22

Hello ZZ,

I recently used the Autocomplete and Releated Queries in the way you appear to be using them.  Unfortunately there are limitations on these APIs that make them less useful.

There is no mid-word or mid-phrase matching for Autocomplete.  So if you have an autocomplete of "Red Cars" it is not an option if you start typing "cars".  The idea of these APIs is that they are based on search terms provided, not the content in your system as these are meant to be light weight.

There is also the risk of statistical auto completes being manipulated by malicious actors.  

e.g. a site that sells stationary has a lot of search for pencils.  Noticing the behaviour of the system, a malicious actor then performs lots of searches with the term "pencil P****".  Because "pencil" matches and they click on something, that then enters the site statistics.  A few repetitions with click throughs later and the next person who searches for "pencil" also gets a search term of "pencil P****" appearing.  Effectively allowing malicious actors to make your site flag rude words to your client's customers.

Either you then have to start sanitizing your autocompletes or you go back down the path having your autocomplete do simple content searches instead.

Edited, Feb 17, 2023 11:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.