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 -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Apr-12 07:13 UTC
[Ferret-talk] setting the default operator on a QueryParser
Hi! On Tue, Apr 11, 2006 at 10:42:35PM +0200, roop wrote:> 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);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 kraemer at webit.de 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. -- Posted via http://www.ruby-forum.com/.