lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Robert <cr_use...@arcor.de>
Subject Pagination and Sorting
Date Thu, 01 Oct 2009 11:17:07 GMT
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 =
    indexSearcher.search(query, 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message