【问题标题】:SphinxQL wildcardSphinxQL 通配符
【发布时间】: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 使用 %

标签: java sphinx wildcard


【解决方案1】:

需要 dict=keywords 前缀匹配才能处理 rt 索引。

http://sphinxsearch.com/docs/2.0.4/conf-dict.html

注意它现在只支持前缀搜索,中缀在 rt 索引上不起作用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多