GWT make suggestions after search with no hits

108 views Asked by At

I have a database with words, and I use suggestbox of GWT to make search with suggestions. I want, after a search that lead to no hits, to make suggestions with the closest words in my database.

For example, if the user inputs "vadin", and this word doesn't exist in the database, but "vaadin" and "avide" do, I'd like to display a message like:

Do you mean "vaadin" or "avide"?

Any ideas on how to achieve this?

1

There are 1 answers

2
spg On

Maybe you could calculate the Levenshtein distance between the query string and some words in your database?