lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Carlson <>
Subject Re: Restrict number of hits
Date Sat, 11 May 2002 05:43:53 GMT

The FAQ answer on this one is

17. How can I restrict the number of hits ?

As far as we know, there is no way at this time (Lucene 1.0, May 2001) to
instruct Lucene to collect only a specified number of hits. However, when
you get the hit list back from the search method, you can ignore the ones
you don't need. 

It doesn't seem to be a problem to have many hits because internally only
the first 200 (I think that's the right number), are kept in an active stack
to start.  It will grab more if necessary. Also, Lucene is optimized to not
get the Hit information from the index until it is required.

Why are you trying to restrict the total hits?


On 5/10/02 10:42 AM, "" <> wrote:

> there any way to restrict the number of hits returned by a query?
> I would like to have the functionality of getting only the X last
> documents which respect to a given query condition. I've seen
> something on making an HitCollector class, but if there is a plenty
> more than X documents which respect the condition, that doesn't mean
> that they would all be processed? How can I avoid that?
> Thanks in advance,
>  Hélder Ribeiro

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

View raw message