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.del...@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-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to