0

I am trying to check if my config has issues or I am not understanding Show Meta correctly;

If I make a regex in the config:

regexp_filter=NY=>New York

then if I do a SphinxQL search on 'NY'

Search Index where MATCH('NY')

and then Show Meta

it should show keyword1=New and keyword2=York not NY is that correct?

And if it does not then somehow my config is not working as intended?

user3649739
  • 1,829
  • 2
  • 18
  • 28

1 Answers1

0

it should show keyword1=New and keyword2=York not NY is that correct?

This is correct. When you do MATCH('NY') and have NY=>New York regexp conversion then Sphinx first converts NY into New York and only after that it starts searching, i.e. it forgets about NY completely. The same happens when indexing: it first prepares tokens, then indexes them forgetting about the original text.

To demonstrate (this is in Manticore (fork of Sphinx), but in terms of processing regexp_filter and how it affects searching works the same was as Sphinx):

mysql> create table t(f text) regexp_filter='NY=>New York';
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t values(0, 'I low New York');
Query OK, 1 row affected (0.01 sec)

mysql> select * from t where match('NY');
+---------------------+----------------+
| id                  | f              |
+---------------------+----------------+
| 2810862456614682625 | I low New York |
+---------------------+----------------+
1 row in set (0.01 sec)

mysql> show meta;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| total         | 1     |
| total_found   | 1     |
| time          | 0.000 |
| keyword[0]    | new   |
| docs[0]       | 1     |
| hits[0]       | 1     |
| keyword[1]    | york  |
| docs[1]       | 1     |
| hits[1]       | 1     |
+---------------+-------+
9 rows in set (0.00 sec)
Manticore Search
  • 1,462
  • 9
  • 9