问题
The new CloudSearch API uses Solr in the backend and Solr has the "Did You Mean?" feature. However, it seems that Amazon has not yet exposed this feature, at least looking at the documentation. I have looked at other questions asking about implementing a "Did you mean?" feature, however if I am not mistaken, in all these cases the asker has control over the search engine.
I was thinking to perhaps send a second search query using fuzzy search if the first search query results in no matches. Would this be a good idea? Is it possible to create a "Did you mean?" / spellchecking type functionality when using CloudSearch?
回答1:
Not quite what you're asking for, but you could implement the Suggester feature to help prevent spellchecking issues:
http://docs.aws.amazon.com/cloudsearch/latest/developerguide/getting-suggestions.html
But why not use fuzzy search in the first place? If you're worried about performance, I'd say time a couple searches with and without fuzzy to see if it's a significant difference.
You can also perform fuzzy searches with the simple query parser. To perform a fuzzy search, append the
~
operator and a value that indicates how much terms can differ from the user query string and still be considered a match. For example, the specifyingplanit~1
searches for the termplanit
and allows matches to differ by up to one character, which means the results will include hits forplanet
.
- http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html
- or a "sloppy phrase search" http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html#searching-text-phrases
来源:https://stackoverflow.com/questions/23863362/implementing-did-you-mean-using-amazon-cloudsearch