lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Index statistics
Date Tue, 05 Jul 2011 19:39:10 GMT
This API doesn't exist today.

Lucene has long needed for queries impls to do this, so that we can
properly plan/optimize how the query is run.  EG an AND query would
use this to pick the more restrictive clause to drive the

For TermQuery you could just call IR.docFreq?  (Doesn't take deletions
into account so it'll always be an upper bound).

For other queries... you could pull the scorer, iterate over some
number of docs, and then "guestimate" based on what docID you got up
to vs how many docs you asked for, how many matches there would be for
the full index?  This would assume matches are uniformly distributed
throughout the index (eg, that docs are indexed in random order) which
is definitely not the case typically in practice.

Mike McCandless

On Tue, Jul 5, 2011 at 2:19 PM, Andres Taylor
<> wrote:
> Hi there,
> A work with Neo4j <>, a NoSQL graph
> database tightly coupled with Lucene. I am now working on an optimizing
> execution engine. To do this well, I would like to know more about the
> existing Lucene indices. Ideally, I'd like to be able to ask a Lucene index
> how many hits a query might give me, before I actually run the query. The
> answer will probably just be an estimation, but that's fine.
> Is this possible today?
> Best regards,
> Andrés

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message