manticoresoftware / manticoresearch

Easy to use open source fast database for search | Good alternative to Elasticsearch now | Drop-in replacement for E in the ELK soon
https://manticoresearch.com
GNU General Public License v3.0
8.89k stars 492 forks source link

Search query parsing error #1282

Open bugsoff opened 1 year ago

bugsoff commented 1 year ago

Getting a syntax error in some cases, if an escaped character is inside brackets:

SELECT * FROM items WHERE MATCH ('(\\q)'); OK

SELECT * FROM items WHERE MATCH ('\\@'); OK

SELECT * FROM items WHERE MATCH ('(\\@)'); ERROR 1064 (42000): index items: syntax error, unexpected ')' near '\@)'

SELECT * FROM items WHERE MATCH ('(\\@a)'); OK

SELECT * FROM items WHERE MATCH ('(a\\@)'); OK

SELECT * FROM items WHERE MATCH ('(qwe) (asd)'); OK

SELECT * FROM items WHERE MATCH ('(qwe) (\\@a)'); OK

SELECT * FROM items WHERE MATCH ('(qwe) (\\@)'); ERROR 1064 (42000): index items: syntax error, unexpected ')' near '\@)'

SELECT * FROM items WHERE MATCH ('(qwe) (a\\@)'); OK

Manticore 6.0.4 1a3a4ea82@230314

bugsoff commented 1 year ago

The same error:

SELECT * FROM items WHERE MATCH ('@* asd @type type1'); OK SELECT * FROM items WHERE MATCH ('@* as\\@ @type type1'); OK SELECT * FROM items WHERE MATCH ('@* \\@ @type type1'); ERROR 1064 (42000): index items: syntax error, unexpected TOK_FIELDLIMIT near ' \@ @type type1'