Rth
January 30, 2024, 7:18am
1
Hi,
I have noticed a weird problem / bug when using morphology_skip_fields with morphology=‘libstemmer_ro’
Here is how the problem can be reproduced
mysql> drop table if exists test;
Query OK, 0 rows affected (0.00 sec)
mysql> create table test (id bigint, title text, title_extras text) charset_table=‘non_cjk’ dict=‘keywords’ index_exact_words=‘1’ min_word_len=‘1’ min_infix_len=‘1’ min_stemming_len=‘5’ morphology=‘libstemmer_ro’ morphology_skip_fields=‘title_extras’;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> insert into test (title, title_extras) values (‘abc def’, ‘xyz’);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * from test WHERE MATCH(‘+xyz’);
Empty set (0.00 sec)
If I drop the morphology_skip_fields it will be working just fine.
Is there somehting obvious that I am missing?
Thank you
tomat
January 30, 2024, 8:21am
2
you could issue
SELECT * from test WHERE MATCH(‘+xyz’);
show meta;
to make sure about the search
or
set profiling=1;
SELECT * from test WHERE MATCH(‘+xyz’);
show plan;
to check for search tree
Rth
January 30, 2024, 8:32am
3
mysql> SELECT * from test WHERE MATCH(‘+xyz’);
Empty set (0.00 sec)
mysql> show meta;
±---------------±------+
| Variable_name | Value |
±---------------±------+
| total | 0 |
| total_found | 0 |
| total_relation | eq |
| time | 0.000 |
| keyword[0] | xyz |
| docs[0] | 0 |
| hits[0] | 0 |
±---------------±------+
7 rows in set (0.00 sec)
mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT * from test WHERE MATCH(‘+xyz’);
Empty set (0.01 sec)
mysql> show plan;
±-----------------±------------------------------+
| Variable | Value |
±-----------------±------------------------------+
| transformed_tree | AND(KEYWORD(xyz, querypos=1)) |
±-----------------±------------------------------+
1 row in set (0.00 sec)
tomat
January 30, 2024, 8:47am
4
you need to issue
SELECT * from test WHERE MATCH(‘=xyz’);
as morphology_skip_fields
indexes terms as term with the exact modifier
or use expand_keywords
index or query option
or use the last daemon version and query exact that field and daemon will do such expansion on its own
you could read the ticket with the explanation strange behavior with morphology_skip_fields · Issue #560 · manticoresoftware/manticoresearch · GitHub
Rth
January 30, 2024, 10:19am
5
It makes sense, thank you!