3

我需要使用类似的东西进行 sql-searches:soundexmetaphonefor androidover phonegap

但既不工作soundex也不metaphone工作。

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

这给我带来了soundex未知的信息。

有人知道我如何使用()或类似的soundex东西吗?soundexphonegapandroid

4

1 回答 1

0

可以在您的电话间隙代码中创建 soundex/metaphone 索引。在 Javascript 中,您可以使用clj-fuzzy 库

  1. 将 soundex/metaphone 列添加到您的customers表中。
  2. 当您插入/更新记录时,在 Javascript 中计算 soundex/metaphone 索引,并插入/更新该值。
  3. 执行搜索时,您可以计算搜索条件的 soundex/metaphone 索引,并根据 soundex/metaphone 列检查其相等性。

所以插入可能看起来像:

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

和选择喜欢:

select * from customers where surname_metaphone = 'SM0'

于 2015-09-25T02:43:52.897 回答