lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: best way to get specific results
Date Thu, 25 May 2006 18:21:44 GMT

: if a query returns 1000 results, the user is interested only in the
: results between 500&550. the way I implemented it is run a normal query
: using and then get the specified documents
: out of the hits object. I am wondering if there is a more efficient way
: than this, is using TopDocs better than the hits object, knowing that
: some users may need more than a 1000 docs back in one query?.

generally speaking, yes TopDocs (or TopFieldDocs) are better then Hits if
you plan on acessing morethen the first 100 or so results .. Hits will
reexecute your search over and over as you ask for higher numbered
results, while with TopDocs you search is executed once, and you are given
only the Doc IDs of the first N docs you asked for, with no other
processing done behind the scenes  (in your case, it sounds like N would
be 550, and you'd start accessing the ScoreDoc[] at 500.


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

View raw message