我正在通过PHP用户通过名称和姓氏在mysql数据库中搜索,问题是:
在数据库用户表中我有:
split: {
size: 5,
tracker: {
tolerance: 0
}
}
当我尝试搜索时,我得到了这样的结果:
| name | LastName |
+---------------+-------------+
| Ivijan-Stefan | Stipic |
+---------------+-------------+
| Ronny | o'Sulivan |
问题:
Ivijan-Stefan Stipic - OK (only my profile)
Ivijan - OK + related results with same name
Stefan - OK + related results with same middlename or name
Stipic - OK + related results with same last name
Ivijan-Stefan - OK + related results with same name
以下是我的查询示例:
Ivijan Stefan - NO RESULTS
Ivijan Stefan Stipic - NO RESULTS
我也试试这个:
SELECT * FROM `users` WHERE CONCAT(`name`, ' ', `lastname`) LIKE '%{SEARCH_DATA}%'
但我有类似的问题。
如何解决这个问题?另外如果有人尝试先输入姓氏然后命名,如何搜索?