lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: rewrite()ing BooleanQuery results in empty clauses
Date Wed, 04 Nov 2009 10:04:05 GMT
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@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@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message