lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anshum <>
Subject Re: Pagination and Sorting
Date Thu, 01 Oct 2009 11:43:36 GMT
You could get the hits in a collector and pass the sort to the collector as
it would be the collect function that handles the sorting.,collector);

Hope that gives you some headway. :)

Anshum Gupta
Naukri Labs!

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............

On Thu, Oct 1, 2009 at 4:47 PM, Christian Robert <> wrote:

> Hello everybody,
> I'm looking at quite an interesting challenge right now, so I
> hope that somebody out there will be able to assist me.
> What I'm trying to do is returning search results both sorted and
> paginated. So far I haven't been able to come up with a working solution.
> Pagination without sorting is no problem - simply looping through the
> document identifiers and grabbing the documents within my "pagination
> window".
> Sorting is also no problem - create the Sort object and executing the
> search.
> However, when using a Sort I always get a TopDocs object in which all
> the identifiers of the documents are contained. No problem when dealing
> with a small index, but I've some 700.000 documents indexed and each
> time I'm trying to call
>  TopDocs topDocs =
>, null, Integer.MAX_VALUE, sort);
> I'm ending up with an OutOfMemoryError.
> So it seems that Lucene needs all the documents loaded into memory for
> the sorting to work where in contrast I only want to load the documents
> to be displayed in the current pagination window.
> Am I lost here and have to find another way or is there a working
> solution to combine sorting and pagination?
> Thanks in advance!
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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