lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Vasilev <>
Subject Best way for paging with TopDocs class?
Date Thu, 16 Apr 2009 14:58:48 GMT
Hi All,

As Hits class was deprecated in current Lucene and is expected to be 
excluded from Lucene 3.0 we decided to change our code so that to use 
TopDocs class.
Our app provides paging and now we are uondering what is the bset way to 
do it with th TopDocs. I can see only this possibility:
1. User opens page 1 - we load by, docNum, ... ) 
method as many docs as for page 1;
2. User opens page 2 - we load as many results as the amount for page 1 
and page 2 (note that docs for page 1 are loaded again);
N. User opens page n - we load as many docs as the amount of all pages 
from #1 to #N (note that page 1 docs were loaded N-1 times, page 2 docs 
N-2 times etc).

With Hits class this loading of documents of previous pages was avoided 
- they were loaded once and when needed docs for the next page Hits just 
loaded the next portion of docs without reloading the previous pages.

So my question is:
Is there better way for paging with the class TopDocs than the one that 
I describe here?

Thanks in Advance,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message