Spellcheck, Did you mean

Hi there! I’m working on a project using enonic 6.5 and we needed some things related to the search which I think the implementation of ElasticSearch on Enonic is not there yet (or not documented). When I’m typing on the searchbox, I need to get an autocomplete, but I cant use the API’s like Google ones because I don’t need/want words that I don’t have on my contents. When I search something, we need to return a “Did you mean xxxx?” phrase if the word or expression does not match any content on my base.
I see Elastic Search has a native term suggester, but I don’t know how it can be implemented on enonic or if it is on the DevTeam future builds. What about?
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-term.html

1 Like

Hi,

Suggesters are planned for the future, but as you suspect its not implemented yet.

As a temporary solution, please consider the ngram and fulltext-functions for the searches:

http://xp.readthedocs.io/en/latest/developer/search/query-functions/fulltext.html
http://xp.readthedocs.io/en/latest/developer/search/query-functions/ngram.html

Both support a levenshteins distance algorithm to do a fuzzy match for terms in the search-string.
e.g

ngram('title', 'fsih~2 chik~2', 'OR')

The above query will match documents containting fish or chicken, like fishingboats and chickensoup.

Hope this can help a bit until we get the suggester API up and running.

We have added the suggest feature to our backlog. ETA not decided.