lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: Paging & Sorting
Date Tue, 05 Aug 2008 21:16:38 GMT
Sure, just iterate over the first 100 entries in your Hits object
(or topdocs).

If you're asking how to ignore 49,900 of your documents (that
is, not even consider them at all), you're asking the impossible
because you can't know whether to ignore those other docs
unless you sort them first.

If you're asking if you can get the 100 most relevant docs and
then sort only those, then you should look at FieldSortedHitQueue.
What you'd do is feed the top 100 documents into an instance
of FieldSortedHit queue then read traverse the queue.

If none of this applies, could you explain in a bit more detail?


On Tue, Aug 5, 2008 at 4:35 PM, Neeraj Gupta <>wrote:

> Hi,
> I need first 100 documents in a sorted order lets say sorted on the
> document id and there are more then 50K documents in the index. My search
> query is matching all those 50K documents. Is there any way to get only
> first 100 documents that too in a sorted order of document id. I mean
> Lucene will only give out those 100 documents?
> Many Thx!
> The information contained in this e-mail and any accompanying documents may
> contain information that is confidential or otherwise protected from
> disclosure. If you are not the intended recipient of this message, or if
> this message has been addressed to you in error, please immediately alert
> the sender by reply e-mail and then delete this message, including any
> attachments. Any dissemination, distribution or other use of the contents of
> this message by anyone other than the intended recipient is strictly
> prohibited. All messages sent to and from this e-mail address may be
> monitored as permitted by applicable law and regulations to ensure
> compliance with our internal policies and to protect our business. E-mails
> are not secure and cannot be guaranteed to be error free as they can be
> intercepted, amended, lost or destroyed, or contain viruses. You are deemed
> to have accepted these risks if you communicate with us by e-mail.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message