Hi, I was wondering what would be the best approach to deal with the situation when some documents are deleted and it is unclear on whether deletions have resulted any pending commits.
In a single thread scenario this seems to be as simple as 1 indexWriter.deleteDocuments(query); // same for terms arg 2 if (indexWriter.hasUncommittedChanges()) { 3 indexWriter.commit(); 4 } However, I am not sure if this works as nicely in multi threaded environment, where a possible race condition can happen between lines 2 & 3. How feasible would it be for .deleteDocuments() to return a number telling how many documents have actually been deleted? Also, how cheap is .hasUncommittedChanges()? - my quick code scan shows that there's no I/O is involved, but maybe somebody can confirm this? And if this is cheap, why this method isn't invoked in the beginning of indexWriter.commit()? Thank you. m. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org