lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Confused about boolean query and how an IndexReader is associated with Hits
Date Wed, 07 Dec 2005 13:28:04 GMT

On Dec 7, 2005, at 7:06 AM, Alan Chandler wrote:

> Erik Hatcher writes:
>> On Dec 7, 2005, at 2:38 AM, Alan Chandler wrote:
>>> Worse than that, when I attempt to access Hits.doc(0) I am  
>>> getting an
>>> immediate IOException with the message "Bad file descriptor".  I   
>>> think
> ...
>> You must keep your IndexSearcher instance alive and well when  
>> working  with Hits.  Hits internally uses the searcher to page  
>> through results  - it does not keep all results in memory.  I'm  
>> not sure why you  aren't seeing all the documents you expect, but  
>> if you package it up  as a simple RAMDirectory-using JUnit  
>> TestCase then I'd be happy to  run it and see.
> mmm!  Going to have to rething my "Database" interface, so that I  
> actually get the page of results I need coupled with the search.
> How do you get over the fact that the hits may be on several web  
> pages and the user may go away between getting the hits and  
> actually retrieving a document in detail.  Do you have to serialize  
> the searcher and put it into a session?

One option is to just carry along the key to the document, generally  
something unique like an "id" field.  When a request comes in for a  
document, it would pass it's document id, not the hit number.  Then  
simply search using a TermQuery for that document, or use IndexReader  
to navigate to it.


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

View raw message