-3

in my Android app I need to select data from a SQLite database. However, I have a search field in which users can type the name of a location. As they may typo this name, I need to be able to draw the relevant records from the database according to this.

For example:

Input: Ferris Whrrl

Actual: Ferris Wheel

It should locate the Ferris Wheel entry correctly despite the typo. I realise that editdist3 is not implemented in Android SQLite. I'd also rather not select the entire database into RAM and loop through all Strings and calculate Levenshtein distance manually as this would be super resource intensive.

Any help will be greatly appreciated!! :)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
ashiswin
  • 637
  • 5
  • 11

2 Answers2

0

I think the best thing you can do is to implement an Auto Suggestion function just like all search engines nowadays do.

You could implement a dynamic algorithm that searches and caches values as needed when a new letter is entered. However, if you just operate on the bare metal without the help of any external service you will have resource problems too - depending on the size of your database and other context variables.

Having a proper index will help but I still think to load the all necessary values into an array and search is faster.

wp78de
  • 18,207
  • 7
  • 43
  • 71
-1

Here you need to create an AI system to guess the correct word. I think this is not relevant to SQL or Android.

Or you can use online AI system to guess the correct word.

SadeghAlavizadeh
  • 609
  • 3
  • 17
  • 33