所以我想使用全文搜索来实现更好的搜索功能,但是它的行为并不像预期的那样。它不会返回任何结果,或者我认为不相关的结果。
首先,我检查了:
显示变量,如 'ft_min%'
...返回为 4
所以我有一个充满游戏名称的数据库。搜索的一个很好的例子是“刺客信条”。在数据库中,它们实际上存储为“刺客信条”(注意撇号)。因此,如果我执行以下查询:
SELECT g_name, MATCH(g_name) AGAINST ('assassins creed') AS score FROM tgmp_games WHERE MATCH(g_name) AGAINST ('assassins creed') LIMIT 15
返回结果很好(下面的一些)
...但是使用搜索脚本,它使用 JqueryUI 自动完成下拉菜单,并且当提交查询字符数少于整个单词的任何内容时,它返回为空
SELECT g_name, MATCH(g_name) AGAINST ('assass') AS score FROM tgmp_games WHERE MATCH(g_name) AGAINST ('assass') LIMIT 15
我还读到数据库中的行数如果太低会产生影响,但是那里有 25k 行,所以应该没问题。我究竟做错了什么?
我可以得到的结果的输出,但更感兴趣的是如何让零件搜索词返回一些结果。
Array
(
[g_name] => Assassins Creed III
[score] => 15.406005859375
)
Array
(
[g_name] => The Witcher 2: Assassins of Kings
[score] => 8.46316719055176
)
Array
(
[g_name] => Tenchu: Shadow Assassins
[score] => 8.46316719055176
)
Array
(
[g_name] => The Witcher 2: Assassins of Kings - Enhanced Edition
[score] => 8.27909851074219
)
Array
(
[g_name] => Assassin\'s Creed
[score] => 6.84770059585571
)
Array
(
[g_name] => Assassin\'s Creed III
[score] => 6.84770059585571
)
Array
(
[g_name] => Assassin's Creed II
[score] => 6.84770059585571
)
Array
(
[g_name] => Assassin's Creed: Revelations ...
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin\'s Creed: Revelations
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin's Creed: Brotherhood
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin's Creed: Bloodlines
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin's Creed II: Discovery
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin\'s Creed III: Liberation
[score] => 6.77157783508301
)
Array
(
[g_name] => Assassin's Creed: Altair's Chronicles
[score] => 6.69712924957275
)
Array
(
[g_name] => Assassin's Creed II: Bonfire of the Vanities
[score] => 6.69712924957275
)
此外,这个顺序也很奇怪,因为“巫师 2”超越了其他“刺客信条”游戏。不确定是否可以使用某种模式以避免卡在标点符号上?