Hello,

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
requested.

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 :

http://lucene.apache.org/java/2_4_1/api/org/apache/lucene/search/HitCollector.html
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?


thanks,
Savvas

Reply via email to