25 feb 2007 kl. 06.04 skrev Mohammad Norouzi:

still I dont know ehrthrt the reader is important for Hits or Searcher? consider I passed a hits to my ResultSet, now, if I close searcher, will the
Reader get closed?  or another vague thing is can a Reader work thread
safely for every Searcher with differenet queries?

I'm not completely sure what you are asking, so I hope this helps:

If you passed a Directory to the IndexSearcher constructor the IndexReader within will be created at IndexSearcher construction time and closed at IndexSearcher close time.

If you passed an IndexReader to the IndexSearcher constructor, then the IndexReader will not be closed when the IndexSearcher closes. If you do it this way be careful not to leave unused open IndexReader:s around, as they consume memory.

An IndexSearcher requires the IndexReader associated with it to be open, and the same goes for any Hits produced by that IndexSearcher. However, the results in Hits are cached, so even if you close the IndexReader you will be able to access the top n accessed documents. You will always be able to access the document numbers and their score, as that does not require any access of the IndexReader. I.e. accessing documents from Hits requires an open IndexReader.


--
karl



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

Reply via email to