Not sure why you can't close, but it's a bit suspicious that you are
opening the IndexReader every time you do a search. Can you explain a
little more about your process? When are you indexing, how often, etc.?
-Grant
On Mar 12, 2008, at 11:50 AM, Ioannis Cherouvim wrote:
Hello
I can index many times and delete the index files (manually). But if
I search once, then the cfs file is locked and cannot be deleted.
Subsequent indexings create new cfs files. Even if I undeploy the
tomcat web application which holds the search code, the cfs file
cannot be deleted.
O/S:
Windows XP
Code to index:
IndexWriter writer = new IndexWriter(
PATH,
new StandardAnalyzer(),
true);
writer.addDocument(doc1);
writer.addDocument(doc2);
writer.addDocument(doc3);
writer.optimize();
writer.close();
Code to search:
Searcher searcher = null;
IndexReader indexReader = null;
try {
indexReader = IndexReader.open(PATH);
searcher = new IndexSearcher(indexReader);
Hits hits = searcher.search(query);
...
} finally {
searcher.close();
indexReader.close();
}
Am I doing something wrong?
thanks,
Ioannis
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------
Grant Ingersoll
http://www.lucenebootcamp.com
Next Training: April 7, 2008 at ApacheCon Europe in Amsterdam
Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]