lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <sar...@syr.edu>
Subject RE: Query Parser, Unary Operators and Multi-Field Query
Date Fri, 20 May 2011 12:21:11 GMT
Hi Renaud,

That's normal behavior, since you have AND as default operator.  This is equivalent to placing
a "+" in front of every element of your query.  In fact, if you removed the other two "+"s,
you would get the same behavior.  I think you'll get what you want by just switching the default
operator to "OR"?

Steve

> -----Original Message-----
> From: Renaud Delbru [mailto:renaud.delbru@deri.org]
> Sent: Friday, May 20, 2011 5:10 AM
> To: java-user@lucene.apache.org
> Subject: Query Parser, Unary Operators and Multi-Field Query
> 
> Hi,
> 
> The behaviour of the query parser (either the standard lucene query
> parser, or the query parser contrib) is not what I expect when I am using
> - unary operators
> - a multi-field query
> - AND as default operator.
> 
> For example, let say I have two field fieldA and fieldB, and the
> following query:
> +termA +termB termC
> 
> Lucene query parsers will expand the query as:
> +(fieldA:termA fieldB:termA) +(fieldA:termB fieldB:termB) +(fieldA:termC
> fieldB:termC)
> 
> while I would have expected this
> 
> +(fieldA:termA fieldB:termA) +(fieldA:termB fieldB:termB) (fieldA:termC
> fieldB:termC)
> 
> Is it the normal behaviour ? A Bug ? Am I doing something wrong ?
> 
> Thanks in advance for your help,
> --
> Renaud Delbru
> 
> ---------------------------------------------------------------------
> 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