lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sol myr <solmy...@yahoo.com>
Subject Newbie: "Life span" of IndexWriter / IndexSearcher?
Date Thu, 13 Jan 2011 15:11:25 GMT
Hi,

We're writing a web application, which naturally needs
- "IndexSearcher" when users use our search screen
- "IndexWriter" in a background process that periodically updates and optimizes our index.
Note our writer is exclusive - no other applications/threads ever write to our index files.

What's the common practice in terms of resource creation and sharing?
Specifically:

1) Should I have a single IndexSearcher to serve all (concurrent) users?
I saw such a recommendation in a tutorial, but discovered that an open IndexSearcher prevents
'optimize' from merging my files... so should I close it just before optimization? Or should
I open an individual (short-lived) IndexSearcher for each search request?

2) Our tests also imply that IndexWriter.optimize()  takes effect only after you close()
that writer - which is a shame, because I hoped to keep using the same writer (I hear it's
expensive to instantiate). I doing something wrong? 

Thanks



      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message