lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <>
Subject Using DeletionPolicy to roll back to previous commit point
Date Tue, 11 Nov 2008 10:27:24 GMT
Probably a question for Mike M.
Is it possible/sensible to use IndexDeletionPolicy to remove the *newest* commit points (as
opposed to the usual scenario of deleting old commit points). 

I experimented with this: 

    class RollbackDeletionPolicy implements IndexDeletionPolicy
        public void onCommit(List commits) throws IOException {

        public void onInit(List commits) throws IOException {
            IndexCommit commit=(IndexCommit)commits.get(commits.size()-1);


And opening and closing a writer...

  void myRollback()
        IndexWriter w=new IndexWriter(dir,analyzer, new RollbackDeletionPolicy(),

This mostly worked but segments.gen was not updated to reflect the regression in the list
of active segments. Is there an API somewhere to reinstate the segments.gen file?
I assume I  would also need to take care to close all readers before attempting a rollback-to-earlier-commitpoint.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message