On Thursday 28 February 2008 01:52:27 Erick Erickson wrote:
> And don't iterate through the Hits object for more than 100 or so hits.
> Like Mark said. Really. Really don't <G>...

Is there a good trick for avoiding this?

Say you have a situation like this...
  - User searches
  - User sees first N hits, perhaps scrolls
  - User chooses to save results to a file

Clearly for the first two, using Hits is normal.  For the third step you would 
be iterating over potentially a larger number of results, so Hits is not 
recommended.  But implementing a HitCollector from scratch to get the same 
results as Hits seems silly, so what is the usual way out of this?  Do you 
re-execute the query using TopDocs?  Or do you call hitDoc(hits.length()) to 
force Hits itself to load the remainder, and then go back to the start and 
iterate through?

Using TopDocs up-front would be desirable but it turns out it tries to 
allocate the maximum you pass in, up-front...

Daniel

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

Reply via email to