Reece, On Friday 11 July 2003 16:05, Wilton, Reece wrote: > Hi, > > I'm having a bit of trouble figuring out the logic for deleting > documents from an index. Any advice is appreciated!
<snip 75% of the experiments> > 4) I created an index with an IndexWriter and then optimized it and > closed it. > For each document: > - I create a new IndexReader, delete the document and close the > IndexReader > - I create a new IndexWriter, add the document and close the IndexWriter > At the end I open the index with an IndexWriter and then optimize it and > close it. > > This works! But it is pretty slow (compared to the other three tests). > Is this the best way of doing this? AFAIK, yes. You can speed this up by using multiple documents, ie. use a document set. Also, you don't need to close the index writer before optimizing. One variation: you might leave the IndexReader open in case you need it for searching, but I wouldn't recommend that under Windows because there an open file cannot be deleted from a directory. Lucene deletes such files during later optimizations. Kind regards, Ype --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
