lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Savvas-Andreas Moysidis <>
Subject Paging in a Lucene search
Date Thu, 06 Aug 2009 09:59:07 GMT

I'd like to ask if anybody has any thoughts on the best strategy to use when
implementing a paging scenario in a Lucene search.

In order to implement my paging list before the view is rendered I need to
know the total number of documents this particular search would return but I
still need to only load the documents of the specific page that has been

I'm thinking of using the search variant of :

*TopFieldDocs search(Query query, Filter filter, int n,Sort sort);*

since I need sorting and filtering and passing indeaxReader.maxDoc() for n.
Will that create an array of size indeaxReader.maxDoc() ?

After the search is finished I can retrieve only the documents I'm
interested by using the sub-list of TopFieldDocs I've worked out.

In the HitCollector docs :
I can see a way to use a BitSet but I'm not quite sure how this can be used
to retrieve documents.

Any alternatives/better ideas?


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