Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

rewrite()ing BooleanQuery results in empty clauses

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


ssenecal.work at gmail

Nov 4, 2009, 12:28 AM

Post #1 of 2 (114 views)
Permalink
rewrite()ing BooleanQuery results in empty clauses

I am rewriting some BooleanQueries and the end result contains some empty
queries.

The initial query is of the form: Field1:foo* Field2:foo* Field3:foo*
Field4:foo* Field5:foo* Field6:foo*

The rewritten query is of the form: ConstantScore(Field1:foo*)
ConstantScore(Field2:foo*) ConstantScore(QueryWrapperFilter())
ConstantScore(QueryWrapperFilter()) ConstantScore(QueryWrapperFilter())
ConstantScore(QueryWrapperFilter())

The thing is, the BooleanQueries contained in the QueryWrapperFilter()s have
no clauses present. Would this affect the performance of the query at all?
Is there a way I can prevent empty queries like these from being written if
there is a performance penalty?


Shaun


lucene at mikemccandless

Nov 4, 2009, 2:04 AM

Post #2 of 2 (102 views)
Permalink
Re: rewrite()ing BooleanQuery results in empty clauses [In reply to]

For 2.9, I believe there's hardly any runtime cost to the embedded
BooleanQuery instances that have no clauses -- when the scorer method
is invoked, it will return null, which will in turn translate into an
DocIdSet.EMPTY_DOCIDSET that ends the iteration immediately on the
first call to nextDoc.

But if you test this and find otherwise, please report back!

Mike

On Wed, Nov 4, 2009 at 3:28 AM, Shaun Senecal <ssenecal.work[at]gmail.com> wrote:
> I am rewriting some BooleanQueries and the end result contains some empty
> queries.
>
> The initial query is of the form: Field1:foo* Field2:foo* Field3:foo*
> Field4:foo* Field5:foo* Field6:foo*
>
> The rewritten query is of the form: ConstantScore(Field1:foo*)
> ConstantScore(Field2:foo*) ConstantScore(QueryWrapperFilter())
> ConstantScore(QueryWrapperFilter()) ConstantScore(QueryWrapperFilter())
> ConstantScore(QueryWrapperFilter())
>
> The thing is, the BooleanQueries contained in the QueryWrapperFilter()s have
> no clauses present.  Would this affect the performance of the query at all?
> Is there a way I can prevent empty queries like these from being written if
> there is a performance penalty?
>
>
> Shaun
>

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

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.