3

I need to make sql-searches using something like: soundex or metaphone for android over phonegap.

But neither soundex nor metaphone works.

Example: SELECT * FROM customers WHERE soundex(surname) = soundex('Mayer');

This brings me the message, that soundex isn't known.

Does anybody know how I can use soundex or something like soundex with phonegap (android)?

9edge
  • 819
  • 1
  • 9
  • 19
afriend
  • 421
  • 1
  • 4
  • 6

1 Answers1

0

It would be possible to create the soundex/metaphone index in your phone gap code. In Javascript you could use the clj-fuzzy library.

  1. Add a soundex/metaphone column to your customers table.
  2. When you insert/update the record, calculate the soundex/metaphone index in Javascript, and insert/update that value, too.
  3. When executing a search, you can calculate the soundex/metaphone index of the search criteria, and check its equality against the soundex/metaphone column.

So the insert might look like:

insert into customers (surname, surname_metaphone) values ('Smith', 'SM0')

And the select like:

select * from customers where surname_metaphone = 'SM0'

Donald Hughes
  • 6,627
  • 8
  • 35
  • 46