On 10/16/06, Jim Kane <[EMAIL PROTECTED]> wrote: > During our last week of Ferret / aaf usage (also our first week of > Ferret / aaf usage), I have received 8 messages stating that our app > encountered a Ferret::QueryParser::QueryParseException. For instance: > > A Ferret::QueryParser::QueryParseException occurred in foo#search: > > Error occurred in src/q_parser.y:279 - yyerror > couldn't parse query "com -- 404". Error message was syntax error > > /where/gems/are/stored/gems/ferret-0.10.11/lib/ferret/index.rb:709 in > 'parse' > > (thanks to the excellent exception_notification plugin for what you see > above) > > So I did a little research into the Exception, which only left me with > more questions. According to the RDoc for Ferret, the > Ferret::QueryParser#new method has a :clean_string option that should > escape any special characters, and by default it's on. I emailed the > author of aaf and he said that he doesn't do anything with this flag, so > it should still be on. In that case, why am I still seeing this > exception? > > Jim
clean_string isn't perfect. It escapes special characters within phrases (except for '<>' and '|' which have special meaning within phrases). It also tries to match up quotes and brackets. If it still can't parse the query then it will raise an exception unless you set :handle_exception to true in which case the exception will be ignored and the query will be parsed as a simple boolean query and all special characters will be ignored. I hope that makes sense. If you have any suggestions I'd be happy to hear them. Cheers, Dave _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

