MySQL
+----+-------------------+----------+--------------+
| id | address | city | state |
+----+-------------------+----------+--------------+
| 1 | 13000 highway 244 | keystone | south dakota |
+----+-------------------+----------+--------------+
(顺便说一句,我省略了一些列以使其更容易)
PHP
$string = mysql_real_escape_string('13000 highway 244 south dakota');
$a = mysql_query("
SELECT * FROM `table` WHERE
CONCAT_WS(' ', `address`, `city`, `state`) LIKE '%$string%'
");
上面的搜索查询不返回任何结果,只有以下内容values
有效:
- 13000 高速公路 244 基石南达科他州
- 13000高速公路244基石
- 基石南达科他州
但是,我也想让以下values
工作:
- 13000 高速公路 244 南达科他州
- 13000公路基石
- 南达科他州公路基石
- 等等
这甚至可能不依赖full-text search
?