lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Fereira <>
Subject QueryParser implicit conjunction
Date Fri, 24 Jun 2005 18:54:59 GMT

Last month there was a brief thread about changing the implicit conjuction 
for search terms from an OR to AND with a response that the API provides a 
setOperator method for doing so.

A site I am developing also required that "AND" be the implicit conjuction 
so I've tried changing that using the QueryParser.setOperator(1) method. I 
put in some logging to confirm that the implicit operator is changing but 
the search results still seem to be producing results using ORing the 
terms.  Here's what the code looks like:

QueryParser qp = new QueryParser( queryField, analyzer);"operator before: "+qp.getOperator());
qp.setOperator(1);"operator after: "+qp.getOperator());
query = qp.parse(searchterms, queryField, analyzer);

In the log files it shows that the operator is 0 before the setOperator(1) 
call has been made, and returns a 1 afterwords.  However, when the search 
is performed it still seems to OR the terms.

As a workaround, we just changed the default operator setting in and rebuilt the jar file but I would prefer to use an 
official release so that we can update without applying our patch.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message