lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Savvas-Andreas Moysidis <savvas.andreas.moysi...@googlemail.com>
Subject Paging in a Lucene search
Date Thu, 06 Aug 2009 09:59:07 GMT
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

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