Setting the default operator on a QueryParser

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
StandardAnalyzer());
parser.setDefaultOperator(QueryParser.Operator.AND);

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

Thanks,
Roop

Hi!

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.

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs