nck-2 / test-rep

0 stars 0 forks source link

make wildcards escapable #1335

Open githubmanticore opened 1 year ago

githubmanticore commented 1 year ago

Right now it's impossible to match word "abc?def" by doing smth like
select * from idx where match('abc\\?def');

This is by design and there's an issue about this in Sphinx bugtracker http://sphinxsearch.com/bugs/view.php?id=1381. Some users even had to migrate to Elastic because of this.

Let's improve this so it's possible.

Few words from Stas from slack https://manticoresearch.slack.com/archives/C5EEXJG31/p1524816195000483:

ну сложность что експандилку переписать надо чтобы она

  • учитывала escapeing пропускала его
  • обрабатывала escape символы как обычные
  • корректно длину перфиксов \ инфиксов после этого считала
  • ну и не начала втромаживать на всех этих проверках для не escape слов

It works fine in mysql and elastic:

mysql> select * from t; 
+------+--------+ 
| id   | Doc    | 
+------+--------+ 
|    1 | abcdef | 
|    2 | abc_ef | 
+------+--------+ 
2 rows in set (0.00 sec) 

mysql> select * from t where Doc like 'abc\_ef'; 
+------+--------+ 
| id   | Doc    | 
+------+--------+ 
|    2 | abc_ef | 
+------+--------+ 
1 row in set (0.00 sec) 

mysql> select * from t where Doc like 'abc_ef'; 
+------+--------+ 
| id   | Doc    | 
+------+--------+ 
|    1 | abcdef | 
|    2 | abc_ef | 
+------+--------+ 
2 rows in set (0.00 sec) 

[root@sehs01 ~]# curl -s -XGET "http://localhost:9200/boardreaderbig_node1/_search?pretty&q=america"|grep total 
    "total" : 1, 
    "total" : 657384, 
[root@sehs01 ~]# curl -s -XGET "http://localhost:9200/boardreaderbig_node1/_search?pretty&q=a?e?i?a"|grep total 
    "total" : 1, 
    "total" : 671313,```