Complementary to my prvious mail I noticed strange behaviour of 
IndexSearcher.close().
Here is a code that does not work : the new IndexWriter() statement throws 
"java.io.IOException: Cannot delete _3.cfs" as if the Index searcher's 
underlying IndexReader where not closed.  

                        IndexSearcher searcher = new 
IndexSearcher("c:\\tmp\\index");
                        searcher = new IndexSearcher("c:\\tmp\\index");
                        searcher.close();

                        writer = new IndexWriter("c:\\tmp\\index",ana,true);
                        doc = new Document();
                        doc.add(Field.Text("text","toto li toto"));
                        writer.addDocument(doc);
                        writer.close();

And now here is a code that works : the only differance with the previous one 
is the QueryParser call before new IndexWriter. The QueryParser .parse 
statement seems to close the IndexReader but I really can't figure how.
 
                        IndexSearcher searcher = new 
IndexSearcher("c:\\tmp\\index");
                        searcher = new IndexSearcher("c:\\tmp\\index");
                        searcher.close();

                        Query query = QueryParser.parse("toto","text",ana);     
                

                        writer = new IndexWriter("c:\\tmp\\index",ana,true);
                        doc = new Document();
                        doc.add(Field.Text("text","toto li toto"));
                        writer.addDocument(doc);
                        writer.close();


Note : I use Lucene 1.4 Final

Does it seem to be a bug ? 

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

Reply via email to