logo       

Re: QueryParser Exception Handling Problem: msg#00068

lang.ruby.ferret.general

Subject: Re: QueryParser Exception Handling Problem

There's a couple of non-obvious things going on here which I just dealt
with recently myself. I'm not using AAF but I would say the issues are
the same.

Firstly if you're using
index.search_each
the query parser that method uses does NOT use the default values -
specifically it does not handle parser errors.

If you're making your own QueryParser, there is another gotcha -> the
docs say to use the parameter handle_parser_errors but that's not right
with 0.10.13. It should be

Ferret::QueryParser.new({:handle_parse_errors => true}) # not
handle_parser_errors like docs say

Note the missing r on parse(r)

Sam

Mark wrote:
> According to the following link:
>
> http://ferret.davebalmain.com/api/classes/Ferret/QueryParser.html
>
> :handle_parser_errors => true is enabled by default and seems to be in
> acts_as_ferret in class_methods.rb of the plugin. However, when I pass a
> special character as a query (e.g., !, -, <, >, etc) it throws an error
> and pukes.
>
> -- snip --
> Error occured in src/q_parser.y:279 - yyerror
> couldn't parse query ``<script>''. Error message was syntax error
> -- end snip --
>
> Anyone know what's going on here?

--
Posted via http://www.ruby-forum.com/.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise