我需要使用类似的东西进行 sql 搜索:soundex
或 metaphone
for android
over phonegap
。
但是 soundex
和 metaphone
都不起作用。
例子:
SELECT * FROM customers WHERE soundex(surname) = soundex('Mayer');
这给我的信息是,soundex
未知。
有谁知道我如何将 soundex
或类似 soundex
的东西与 phonegap
(android
) 一起使用?
最佳答案
可以在您的手机间隙代码中创建 soundex/metaphone 索引。在 Javascript 中你可以使用 clj-fuzzy library .
- 将 soundex/metaphone 列添加到您的
customers
表。 - 当您插入/更新记录时,在 Javascript 中计算 soundex/metaphone 索引,并插入/更新该值, 也是。
- 执行搜索时,您可以计算搜索条件的发音/变音位索引,并检查其是否与 soundex/metaphone 专栏。
所以插入可能看起来像:
插入客户(surname, surname_metaphone)
值('史密斯','SM0')
然后选择像:
从 surname_metaphone = 'SM0' 的客户中选择 *
关于android - Soundex/Metaphone for phonegap on android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14606974/