Soundex / Metaphone for phone conversation on Android
I need to do sql search using something like: soundex
or metaphone
for android
over phonegap
.
But it doesn't work soundex
and metaphone
.
Example: SELECT * FROM customers WHERE soundex(surname) = soundex('Mayer');
This brings me a message that is soundex
not known.
Does anyone know how I can use soundex
or something like soundex
using phonegap
( android
)?
It would be possible to create an index soundex / metaphone in the phone code. In Javascript, you can use the clj-fuzzy library .
- Add the soundex / metaphone column to the table
customers
. - When you insert / update a record, calculate the soundex / metaphone index in Javascript and insert / update that value, too.
- When performing a search, you can calculate the soundex / metaphone index of the search criteria and test its equality against the soundex / metaphone column.
So the insert might look like this:
insert into customers (surname, surname_metaphone)
values ('Smith', 'SM0')
And select select:
select * from customers where surname_metaphone = 'SM0'