Forum: Ferret setting the default operator on a QueryParser

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
roop (Guest)
on 2006-04-12 00:42
Hi all,

Thanks to the authors for the amazing work on Ferret! I have a question
about setting up the standard operators on a QueryParser. I would like
my parser to default to AND queries rather than the default OR.

In Java I would simply do:

QueryParser parser = new QueryParser("contents", new

But I can't find the corresponding method in the Ferret API. Have I
missed it or is there a workaround?

Jens K. (Guest)
on 2006-04-12 11:13
(Received via mailing list)

On Tue, Apr 11, 2006 at 10:42:35PM +0200, roop wrote:
> parser.setDefaultOperator(QueryParser.Operator.AND);
Afair the option is named :occur_default and takes one of
Ferret::Search::BooleanClause::Occur::MUST or
Ferret::Search::BooleanClause::Occur::SHOULD. You can use this option in
the Ferret::Index::Index constructor (which will internally create a
query parser) or directly when constructing the query parser yourself.


webit! Gesellschaft für neue Medien mbH
Dipl.-Wirtschaftsingenieur Jens Krämer 
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
roop (Guest)
on 2006-04-12 22:55
Thanks. The difference between setting the AND/OR default operator
versus setting the MUST/SHOULD default occur appears to be redundant
then? In any case, thanks for the tip.
This topic is locked and can not be replied to.