Just to add to the thoughtful responses from the others, it isn't really that 
bad to do a new search each time. First, the later searches may likely be 
"warm" searches and thus won't take as long as the first search; second, it's 
the searcher.doc(docId) part that will likely hurt the most, but hopefully 
you'll only need to do that for one "page" at a time only (for each request).

Thanks,
Xiaocheng

Mohsen Saboorian <[EMAIL PROTECTED]> wrote: 
Hi,
Is there a way to do emulate paged search in Lucene? I can use the following
peace of code for returning the first page (10 items in each page), but
don't know how to navigate to the next page :-)

 IndexSearcher is = new ...
 ...
 TopFieldDocs tops = is.search(query, null /*filter*/, 10, Sort.RELEVANCE);
 for (int i = 0; i < tops.scoreDocs.length; i++) {
  ScoreDoc scoreDoc = tops.scoreDocs[i];
  System.out.println(is.doc(scoreDoc.doc));
 }

I can see that tops.totalHits, returns all matched documents. So is this
really "paged search", or I'm just doing a complete search and put a window
on the returned result each time?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Emulating-Pages-Search-tf3500169.html#a9775141
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



 
---------------------------------
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

Reply via email to