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 John4982 <jo...@gmail.com> on 2010/04/21 00:12:47 UTC

Short circuit in query ...

Hi

does Lucene search uses short-circuit when i execute query like:

A:10 AND b:20 AND c:30

In general, does position of field names can impact search performance e.g.
if field A with value 10 is more frequent is this mean that this will be
slower than if value 10 is less frequent?

best
John
-- 
View this message in context: http://n3.nabble.com/Short-circuit-in-query-tp738551p738551.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

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


Re: Short circuit in query ...

Posted by Michael McCandless <lu...@mikemccandless.com>.
Lucene attempts to drive the query by the clause that's least
frequent, so order or your clauses will not matter.

But, it uses a simplistic heuristic to do so: it looks at the first
docID for each sub-clause and then reorders them in decreasing docID
order.  This isn't a perfect optimization since conceivably a
low-count sub-clause could just happen to have eg docID 0 matching.

Mike

On Tue, Apr 20, 2010 at 6:12 PM, John4982 <jo...@gmail.com> wrote:
>
> Hi
>
> does Lucene search uses short-circuit when i execute query like:
>
> A:10 AND b:20 AND c:30
>
> In general, does position of field names can impact search performance e.g.
> if field A with value 10 is more frequent is this mean that this will be
> slower than if value 10 is less frequent?
>
> best
> John
> --
> View this message in context: http://n3.nabble.com/Short-circuit-in-query-tp738551p738551.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Re: Short circuit in query ...

Posted by Ian Lea <ia...@gmail.com>.
The order does not matter but searches on terms with few matches are
likely to be quicker than searches on terms with many matches,


--
Ian.


On Tue, Apr 20, 2010 at 11:12 PM, John4982 <jo...@gmail.com> wrote:
>
> Hi
>
> does Lucene search uses short-circuit when i execute query like:
>
> A:10 AND b:20 AND c:30
>
> In general, does position of field names can impact search performance e.g.
> if field A with value 10 is more frequent is this mean that this will be
> slower than if value 10 is less frequent?
>
> best
> John
> --
> View this message in context: http://n3.nabble.com/Short-circuit-in-query-tp738551p738551.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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