0

I have a date field (Start_date) in my database that have indexed it in sphinx as sql_field_string and it's format is like: 2000-12-12. When I want to search on that field I submit a query like this:

select * from all where match ('@Start_date 2000-12-12'); 

and it's working, but I'm having trouble when submitting a query with OR operator like this that does not return any results while in fact there are many results:

select * from all where match ('@Start_date 2000-12-12 | 1999-12-12');

And when I use Parentheses for values, problem is fixed!

select * from all where match ('@Start_date (2000-12-12) | (1999-12-12)');

Why is this happening ?

( I have added '-' character to my charset_table).

from sphinx.conf file:

dict = crc
min_infix_length=3
DAVID_ROA
  • 309
  • 1
  • 3
  • 18
  • Did you rebuild the index (and allow searchd to load it!) after adding - to charset_table? – barryhunter Jul 17 '18 at 11:28
  • Yes. Should I use unicode of '-' character or '-' itself when changing charset_table value? I used this value: charset_table = -, 1..9, english – DAVID_ROA Jul 17 '18 at 11:45
  • well in theory just a vanila - should be ok, it can't be misinterpreted as syntax (like comma and dot), but putting U+2D would be safer. – barryhunter Jul 17 '18 at 15:39
  • 1
    But it might just be that - is also extended syntax operator, so maybe its you need to escape it. `match('@Start_date 2000\\-12\\-12 | 1999\\-12\\-12');` - the double slash, need to escape it as part of the SQL string too!) – barryhunter Jul 17 '18 at 15:40
  • Escaping didn't solve the problem and results are not same as when using parentheses. Very strange! – DAVID_ROA Jul 18 '18 at 03:54
  • It also works when I use " character instead of parentheses. Do you have any idea why is this happening? Does the searcher ignore '-' character? – DAVID_ROA Jul 19 '18 at 08:38
  • not 'ignore' as such, but think that because it search operator makes it more complicated (it might get misinpretered sometimes) – barryhunter Jul 19 '18 at 12:39

0 Answers0