Hi Christoph, On Fri, 16 Jul 2004 13:50:51 +0200, Christoph Goller <[EMAIL PROTECTED]> wrote: >[snip on good reasons why an IndexWriter can not delete documents] > >> > If you want to do several updates at the same time, the most efficient > way would be to: > > 1) Keep an IndexReader/Searcher open on your index in order to guarantee > reed access and a consistent index during the whole process. > > 2) Open a new IndexReader and delete all the documents that you want to > update.
This is the main problem; in my current arrangement, it is quite difficult to find out the documents that needs to be updated in advance; it would have been much easier to find out whether every single document where a new entry or a document already present, and thus to update (instead of insert). I can try to work on finding a better way to list of updated documents, but I was hoping to solve this problem with a different route. [...] > > Do you confirm my idea that keeping and IndexWriter open as much as > > possible while indexing batch of documents is a "good thing"? > > Yes. IndexWriter works with a RamDirectory as cache. If you close > it after each document and open a new one, you enforce unnecessary > write operations to your hard disk. > > > Is there any option to ever see a deleteDocument method in the > > IndexWriter class > > Probably not. I guess you either have to update every document separately > as described in your email (open and close a reader and writer for each > document), or do it in the way I describe above (more efficient). I am not competent enough to suggest any possible solution for this problem, but I hope that developers with required knowledge will take this option into consideration for future versions of Lucene as it will really simplify some tasks to the users. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]