code_junkie

Paging Lucene's search results

Nov 12th, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. Hits hits = searcher.search(query);
  2. int offset = page * recordsPerPage;
  3. int count = Math.min(hits.length() - offset, recordsPerPage);
  4. for (int i = 0; i < count; ++i) {
  5. Document doc = hits.doc(offset + i);
  6. ...
  7. }
Add Comment
Please, Sign In to add comment