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 Koji Sekiguchi <ko...@r.email.ne.jp> on 2011/03/10 17:16:41 UTC

getting the number of updated documents

Hello,

Does IndexWriter (or somewhere else) have the method such that
it gets the number of updated documents before commit?

I have an optimized index and I'm using iw.updateDocument(Term,Document)
with the index, and before commit, I'd like to know the number of updated
documents from IndexWriter so that I can rollback if something goes wrong.

Any ideas?

Thanks,

Koji
-- 
http://www.rondhuit.com/en/

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: getting the number of updated documents

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
>> Does IndexWriter (or somewhere else) have the method such that
>> it gets the number of updated documents before commit?
> you have maxDocs which gives you the maxdocid-1 but this might not be
> super accurate since there might have been merges going on in the
> background. I am not sure if this number you are asking for will
> really help you with what you are trying todo.
> If you want to rollback to your previous version why don't you keep
> that commit point around and just open it again if something goes
> wrong. You can specify a DeletionPolicy that keeps your opimized index
> around until you nuke it in the case everything goes ok?
>
> simon

Hi Simon,

Uh, it sounds cool! I'll try to implement a DeletionPolicy and
see if it solves my problem.

Many thanks,

Koji
-- 
http://www.rondhuit.com/en/

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: getting the number of updated documents

Posted by Simon Willnauer <si...@googlemail.com>.
hey Koji,

2011/3/10 Koji Sekiguchi <ko...@r.email.ne.jp>:
> Hello,
>
> Does IndexWriter (or somewhere else) have the method such that
> it gets the number of updated documents before commit?
you have maxDocs which gives you the maxdocid-1 but this might not be
super accurate since there might have been merges going on in the
background. I am not sure if this number you are asking for will
really help you with what you are trying todo.
If you want to rollback to your previous version why don't you keep
that commit point around and just open it again if something goes
wrong. You can specify a DeletionPolicy that keeps your opimized index
around until you nuke it in the case everything goes ok?

simon
>
> I have an optimized index and I'm using iw.updateDocument(Term,Document)
> with the index, and before commit, I'd like to know the number of updated
> documents from IndexWriter so that I can rollback if something goes wrong.
>
> Any ideas?
>
> Thanks,
>
> Koji
> --
> http://www.rondhuit.com/en/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org