0

My index configuration:

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
}

I'm using sphinxsearch 2.2.7. I'm trying to search with the next query:

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

It works well.

But if I try to search by one character, it gives no results:

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

I've tried the same config with a mysql-datasource-based index, got the same results. Yes, I did reindex many times after reconfiguration. Is it bug in sphinx?

EDIT: show meta; and show plan; results:

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)
Nikita
  • 21
  • 1
  • 5

1 Answers1

0

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

The behavior is intentional. We do not allow 1-character substrings for performance reasons. However the documentation on min_infix_len was outdated and did not mention that clearly. I just updated it in the trunk (r4975), thanks for bringing this up.

Nikita
  • 21
  • 1
  • 5