Actually you'd need to open an IndexWriter to do the delete, unless you open a reader, make a change, then close the reader (on closing the reader, which makes a new commit, your deletion policy gets a chance to delete commits).

One question: why are you needing to delete the most recent commit? (Just curious about the use case behind this...).

"Normally", deletion of commits happens when a new commit is created, but I agree that being able to spontaneous delete commits could be nice and would be more straightforward, for Ocean at least. You're sort of out in new territory here (not too many people juggle so many commits in their index)!

To do this we'd have to grab the write lock, create an IndexFileDeleter, delete the commit, close the IndexFileDeleter and release the write lock. But I'm not sure we want to go down that road vs. having IndexWriter be the thing you open to make changes (including deletion of commits) to an index? Maybe, instead, you open a writer, then we expose a deleteCommit(IndexCommit) method...

Mike

Jason Rutherglen wrote:

For Ocean I need to be able to delete the latest commit, however currently using IndexReader.open(final IndexCommit commit, IndexDeletionPolicy deletionPolicy) I need to open the IndexReader that represents the latest commit, presumably in IndexDeletionPolicy.onInit delete the IndexCommit, then close the IndexReader and start over. Wouldn't this be cleaner to call IndexReader.listCommits and then delete the first one (assuming they are in generation descending order).


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

Reply via email to