Compare a string in java with the data stored in a table column
I have taken a string as input, and need to com开发者_JAVA百科pare it with a large volume of data from the database. Basically i have to find the distance between the input string and stored strings of the database table
What would be the perfect and efficient solution for this kind of situation ?
Thanks in advance.
Try the answer from this SO question
Or see this.
Edit: Here's a function for Levenshtein distance in MySQL.
Edit2: An alternative would be to create an index of the strings you search in using a search engine like Lucene, which also supports Levenshtein distance in its queries.
精彩评论