Hi Ngan It might be best ignoring the errors in this situation then... you can do this by setting :ignore_errors => true in your search queries.
Either that or take the regex from Riddle and shrink it down to the set of characters you do want escaped - but you'll probably still want to set :ignore_errors to true anyway, to catch user mistakes on parentheses and such. Cheers -- Pat On 17/09/2011, at 4:16 PM, Ngan wrote: > Hi, I've recently updated to the latest thinking-sphinx version from > ts 1.4.0 -- (unchanged 0.9.9 sphinx). I noticed invalid search > queries now error when a special character is passed in without being > escaped, e.g. searching "$omething" would error. Is this true? Or am > I just going crazy? > > My real question is this: > I need to allow advanced search operators, specifically the NEGATIVE, > OR, and grouping operators: "this -that", "this | that", and "(this | > that) other". Since the errors are happening, I now escape my > incoming query with Riddle.escape. However, this escapes -, |, and > ( )...so searching with operators simply do not work anymore. I've > read other threads saying you have to build your own escaping pattern > etc, but this is very challenging, especially for the parenthesis > operators. If you allow the parenthesis to go through, and the user > provides a missing parenthesis, "(something", then it will error. I > was wondering if there's anyone out there who has handled this or > knows how to handle this...some advice would be wonderful! > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
