lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Dietze ...@fh-wedel.de>
Subject Weird operator precedence with default operator AND
Date Tue, 09 Oct 2007 07:55:47 GMT
Hi,

 I've been going nuts trying to use LuceneParser parse query
strings using the default operator AND correctly:

String queryString = getQueryString();
QueryParser parser = new QueryParser("text", new StandardAnalyzer());
parser.setDefaultOperator(QueryParser.AND_OPERATOR);
try {
  Query q = parser.parse(queryString);
  LOG.info("q: " + q.toString());
  /* [...] */

Here's two example queries and the results I get with and
without the `setDefaultOperator()' statetment:

Query: hose AND cat:Wohnen cat:Mode OR color:blau

- Default-Op OR:  (+text:hose +cat:Wohnen) cat:Mode color:blau
- Default-Op AND: +(+text:hose +cat:Wohnen) cat:Mode color:blau

Query: hose AND ( cat:Wohnen cat:Mode ) OR color:blau

- Default-Op OR:  (+text:hose +(cat:Wohnen cat:Mode)) color:blau
- Default-Op AND: (+text:hose +(+cat:Wohnen +cat:Mode)) color:blau

It seems like theparser handles the default case well, but what
I get with the default operator set to AND is completely
incorrect. I've seen this behaviour with both version 2.1.0 and
2.2.0.

Any hints?

Cheers,

Martin

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
I got it good, I got it bad. I got the sweetest sadness I ever had.
      --- the The

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message