【发布时间】:2012-06-18 11:53:56
【问题描述】:
我想在我的项目中使用 sphinx。我想使用 RT 索引和 sphinxQL。但是我不能使用通配符查询。有人有建议吗?
这是我的 sphinx.conf : 索引测试rt
{
type = rt
path = /usr/local/sphinx/var/data/testrt
charset_type = utf-8
min_infix_len = 1
enable_star = 1
rt_field = name
rt_attr_string = game
}
INSERT:
insert into testrt values(1,'sphinx','sphinx');
查询正常,1 行受影响(0.02 秒)
mysql> select * from testrt;
+--------+--------+--------+ |编号 |重量 |游戏 | +--------+--------+--------+ | 1 | 1 |狮身人面像 | +--------+--------+--------+ 1 行(0.01 秒)
mysql> select * from testrt where match('sphinx');
+--------+--------+--------+ |编号 |重量 |游戏 | +--------+--------+--------+ | 1 | 1500 |狮身人面像 | +--------+--------+--------+ 一组中的 1 行(0.00 秒)
mysql> select * from testrt where match('sphin*');
空集(0.00 秒)
mysql> select * from testrt where match('sphin\\*');
空集(0.02 秒)
希望你能帮我一个忙。谢谢!
【问题讨论】:
-
不应该是
%而不是*吗? -
Sphinx 使用 * 作为通配符。 Mysql LIKE 使用 %