You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by An Hong <An...@i365.com> on 2009/02/24 01:16:19 UTC
IndexWriter.rollback() logic question
A question about IndexWriter.rollback() logic. Its javadoc says that it "Close the IndexWriter without committing any of the changes that have occurred since it was opened." So if I do
1. Open IndexWriter
2. Add doc1
3. Commit (successfully)
4. Add doc2
5. PrepareCommit()
6. Rollback()
Is doc1 in the index? If not, I wonder how come rollback() does not roll back to the last successful commit() state instead?
Thanks,
An
Re: IndexWriter.rollback() logic question
Posted by Michael McCandless <lu...@mikemccandless.com>.
The javadoc is not right -- I just committed a fix.
rollback() discards all changes since the last commit, or since the
IndexWriter was opened (if commit hasn't been called).
So in your case, doc1 is in the index but doc2 is not.
You can also call rollback() not having called prepareCommit().
Mike
An Hong wrote:
> A question about IndexWriter.rollback() logic. Its javadoc says
> that it "Close the IndexWriter without committing any of the changes
> that have occurred since it was opened." So if I do
> 1. Open IndexWriter
> 2. Add doc1
> 3. Commit (successfully)
> 4. Add doc2
> 5. PrepareCommit()
> 6. Rollback()
>
> Is doc1 in the index? If not, I wonder how come rollback() does not
> roll back to the last successful commit() state instead?
> Thanks,
> An
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org