How to change default conjunction with Lucene MultiFieldQueryParser

Posted by Luke H on Stack Overflow See other posts from Stack Overflow or by Luke H
Published on 2009-06-10T18:31:25Z Indexed on 2010/04/07 2:13 UTC
Read the original article Hit count: 414

Filed under:
|

I have some code using Lucene that leaves the default conjunction operator as OR, and I want to change it to AND. Some of the code just uses a plain QueryParser, and that's fine - I can just call setDefaultOperator on those instances.

Unfortunately, in one place the code uses a MultiFieldQueryParser, and calls the static "parse" method (taking String, String[], BooleanClause.Occur[], Analyzer), so it seems that setDefaultOperator can't help, because it's an instance method.

Is there a way to keep using the same parser but have the default conjunction changed?

© Stack Overflow or respective owner

Related posts about lucene

Related posts about operators