"Did you mean" query

I would like to implement something like Google's "Did you mean?" search. What do you recommend?

My thoughts are you would need to keep an index of queries and increment a query each time it is searched. Since most people will type in the query correctly then you can suggest a query that is searched for more. Phrase suggester doesn't allow you to weight/score the queries so I don't think that's the way. Any ideas???

Someone mentioned fuzzy search to me but wouldn't that mean the phrase would have to start with the user entry? Not sure if that is appropriate.

When people use the phrase suggester, they usually run suggestions against the "data" index, not an index that contains queries by other users. That's not to say you can't do it certainly, it just isn't as common. It's also easily abused... a person or bot could execute many queries to populate the index with suggestions that they want shown to other users

Generally, the phrase suggester will return suggestions in the order that best matched the underlying shingles, which is often the "correct" suggestion for a better phrase.

I'd personally try to use the phrase suggester, since it's basically designed for "Did you mean?" style suggestions :slight_smile:

ok. I can guard against people abusing the suggestions so how do I custom-weight the answers?

Does the phrase suggester work with a bool query? I am having issues trying to do that. If I can't weight the results then maybe I can filter them out but the bool query doesn't seem to work with it and I haven't found any example in the docs. A filter or weight would allow me to exclude the bots you bring up. thanks

Can the context suggester be used here? If so, how?

I'm guessing there are no good answers here. Open an issue?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.