java - SphinxQL 通配符

标签 java sphinx wildcard

我想在我的项目中使用 sphinx。我想使用 RT 索引和 sphinxQL。但是我不能使用通配符查询。有人有建议吗?

这是我的 sphinx.conf : 索引测试

{
    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 | sphinx | +------+--------+--------+ 一组中的 1 行(0.01 秒)

mysql> select * from testrt where match('sphinx');

+------+--------+--------+ |编号 |重量 |游戏 | +------+--------+--------+ | 1 | 1500 | sphinx | +------+--------+--------+ 一组中的 1 行(0.00 秒)

 mysql> select * from testrt where match('sphin*');

空集(0.00 秒)

 mysql> select * from testrt where match('sphin\\*');

空集(0.02 秒)

希望你能帮我一个忙。谢谢!

最佳答案

需要 dict=keywords 前缀匹配才能在 rt 索引上工作。

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

请注意,目前仅支持前缀搜索,中缀在 rt 索引上不起作用

关于java - SphinxQL 通配符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11082261/

相关文章:

java - 运行简单 EJB 应用程序时出现问题

mysql - 是否可以在安装完 php、mysql 等之后再安装 Sphinx?

java - 通配符声明的非显式泛型类型的泛型返回类型

mysql - sphinx 和一对多关联

php - 不显示单字符搜索的结果

CSS 通配符选择器

PHP 比较两个字符串中的一个字符不同,通配符方法

java - Java 中的递归处理钻石

java - @transactional带注释的类,使用代理包装,但未创建事务

java - 避免使用 if 子句