0

我的索引配置:

index my_index
{
    # ...
    type = rt
    phrase_boundary = ., ?, U+2026
    charset_table = 0..9, english, russian, _
    dict = keywords
    min_word_len = 1
    min_infix_len = 1
    preopen = 1
    rt_field     = title
    infix_fields = title
}

我正在使用 sphinxsearch 2.2.7。我正在尝试使用下一个查询进行搜索:

mysql> select COUNT(*) from my_index WHERE match('*cc*');
+----------+
| count(*) |
+----------+
|       63 |
+----------+
1 row in set (0.00 sec)

它运作良好。

但是,如果我尝试按一个字符搜索,它不会给出任何结果:

mysql> select COUNT(*) from my_index WHERE match('*c*');
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

我用基于 mysql-datasource 的索引尝试了相同的配置,得到了相同的结果。是的,我在重新配置后确实重新索引了很多次。它是狮身人面像中的错误吗?

编辑: 显示元;及展示计划;结果:

mysql> select COUNT(*) from my_index WHERE match('*cc*');
+----------+
| count(*) |
+----------+
|       63 |
+----------+
1 row in set (0.00 sec)

mysql> SHOW PLAN;
+------------------+------------------------------------------+
| Variable         | Value                                    |
+------------------+------------------------------------------+
| transformed_tree | AND(KEYWORD(*cc*, querypos=1, expanded)) |
+------------------+------------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW META;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| total         | 1     |
| total_found   | 1     |
| time          | 0.000 |
| keyword[0]    | *cc*  |
| docs[0]       | 63    |
| hits[0]       | 63    |
+---------------+-------+
6 rows in set (0.00 sec)

mysql> select COUNT(*) from my_index WHERE match('*c*');
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

mysql> SHOW PLAN;
+------------------+-----------------------------------------+
| Variable         | Value                                   |
+------------------+-----------------------------------------+
| transformed_tree | AND(KEYWORD(*c*, querypos=1, expanded)) |
+------------------+-----------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW META;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| total         | 0     |
| total_found   | 0     |
| time          | 0.000 |
| keyword[0]    | *c*   |
| docs[0]       | 0     |
| hits[0]       | 0     |
+---------------+-------+
6 rows in set (0.00 sec)
4

1 回答 1

0

http://sphinxsearch.com/bugs/view.php?id=2214

这种行为是故意的。出于性能原因,我们不允许使用 1 个字符的子字符串。然而,关于 min_infix_len 的文档已经过时并且没有清楚地提到这一点。我刚刚在后备箱 (r4975) 中更新了它,感谢您提出这个问题。

于 2015-04-02T05:58:41.933 回答