Hi Pedro I guess this is the tricky part - if you're allowing your users to enter @column names, then escaping the full query is definitely not going to work. You'd need to parse the query into sections, and only escape the parts that aren't @column names.
Cheers -- Pat On 04/04/2011, at 9:11 PM, Pedro Cunha wrote: > Hello Pat, > > Escaping the string doesn't like it works, because if I do: > > Sphinx Querying: '\@zona alfama' > Sphinx (0.005202s) Found 0 results > > Sphinx Querying: '@zona alfama' > Sphinx (0.009924s) Found 6 results > > This on extended mode. > > Code: > def escape_search > if not params[:search].blank? > params[:search] = Riddle.escape params[:search] > end > end > > Do i need to configure something else? > > > Best regards, > Pedro > > > On 23 March 2011 17:01, Pat Allan <[email protected]> wrote: > Hi Pedro > > There's no specific TS/Ruby exception for the syntax errors - but you could > try catching ThinkingSphinx::SphinxError. > > Also, perhaps it's worth considering escaping user input to search queries? > Riddle.escape('@foo') # => '\@foo' > > -- > Pat > > On 23/03/2011, at 9:04 AM, Pedro Cunha wrote: > > > Hello, > > > > Seems like extended mode, as search mode, is nearly perfect but can > > also do a lot of weird things making sphinx to just go nutz. > > > > I would like to be to search for: > > > > 1) word1 word2 word3 > > > > 2) "word1 word2 word3" > > > > Which can and shall retrive different results. > > > > Browsing over the docs looks like the extended mode allows this. > > > > But I'm bit concerned about the parser, because It allows a lot of > > other functionalities and if you make a typo (which could be on > > purpose..), sphinx just throws an error. Escaping the search query > > doesn't seem to solve everything, I know I can write things @field or > > < > etc.. Is there a clean way to properly catch this syntax/parser > > errors? > > > > Best regards, > > Pedro > > > > -- > > 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. > > > > -- > 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.
