You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Nick Burch <ni...@torchbox.com> on 2005/02/03 11:38:32 UTC

Rewrite causes BooleanQuery to loose required terms

Hi All

I'm using lucene from CVS, and I've discovered the rewriting a 
BooleanQuery created with the old style (Query,boolean,boolean) method,
the rewrite will cause the required parameters to get lost.

Using old style (Query,boolean,boolean):
query = +contents:test* +(class:1.2 class:1.2.*)
rewritten query = (contents:tester contents:testing contents:tests) 
  (class:1.2 (class:1.2.3 class:1.2.4))

Using new style (Query,BooleanClause.Occur.MUST):
query = +contents:test* +(class:1.2 class:1.2.*)
rewritten query = +(contents:tester contents:testing contents:tests) 
  +(class:1.2 (class:1.2.3 class:1.2.4))

Attached is a simple RAMDirectory test to show this. I know that the 
(Query,boolean,boolean) method is depricated, but should it also be 
broken?

Thanks
Nick

Re: Rewrite causes BooleanQuery to loose required terms

Posted by Paul Elschot <pa...@xs4all.nl>.
On Thursday 03 February 2005 11:38, Nick Burch wrote:
> Hi All
> 
> I'm using lucene from CVS, and I've discovered the rewriting a 
> BooleanQuery created with the old style (Query,boolean,boolean) method,
> the rewrite will cause the required parameters to get lost.
> 
> Using old style (Query,boolean,boolean):
> query = +contents:test* +(class:1.2 class:1.2.*)
> rewritten query = (contents:tester contents:testing contents:tests) 
>   (class:1.2 (class:1.2.3 class:1.2.4))
> 
> Using new style (Query,BooleanClause.Occur.MUST):
> query = +contents:test* +(class:1.2 class:1.2.*)
> rewritten query = +(contents:tester contents:testing contents:tests) 
>   +(class:1.2 (class:1.2.3 class:1.2.4))
> 
> Attached is a simple RAMDirectory test to show this. I know that the 
> (Query,boolean,boolean) method is depricated, but should it also be 
> broken?

No.
Currently, the "old" constructor for BooleanClause does not carry the
old state forward.
The "new" constructor does carry the new state backward.

I'll post a fix in bugzilla later.

Thanks,
Paul Elschot.


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