|
As far as I can tell from the
docs you should open a reader, delete all the documents you need to
delete and close the reader. The open a writer, add all the documents
you need to add and close it. I wouldn't wrap them into other classes
since you loose granularity on what you really want to happen. In the
project I am developing using Lucene.Net I'm doing something like the
following into a method which gets called on a regular basis into a
singleton class, to ensure that this instance is the only responsible
for creating writers which lock the index: public void UpdateIndex() { [...] // Create new IndexReader to update the index indexReader = IndexReader.Open(indexDirectory); // Here remove files from the index using the indexReader instance // Close the IndexReader indexReader.Close(); indexReader = null; // Create a new IndexWriter to add new documents to the index indexWriter = new IndexWriter(indexDirectory, new StandardAnalyzer(), false); // Here add documents to the index using the indexWriter instance // Close the IndexWriter indexWriter.Optimize(); indexWriter.Close(); indexWriter = null; } Simone Patrick Burrows wrote: Assuming I have assured that only one thread from one process is calling the |
- Index Write Access Patrick Burrows
- Re: Index Write Access Simone Busoli
- Re: Index Write Access Patrick Burrows
- Re: Index Write Access Patrick Burrows
- Re: Index Write Access Simone Busoli
- Re: Index Write Access Patrick Burrows
- Re: Index Write Access Simone Busoli
- unsubscribe Sergiy Savchenko
