You're right IndexCommit doesn't know that it represents an optimized
index.
Likewise, IndexCommit doesn't know other "semantic" things about the
index, eg, you've just called expungeDeletes, or, you just finished
adding batch X of documents to the index, etc.
Also, realize that with autoCommit=false (to be the only choice in
3.0), no commit will be done after an optimize. Ie you have to call
commit() or close() explicitly to make it a commit.
I think the simplest general approach to "know" which commit points
represent "interesting" times to the application would be to call
IW.optimize() then IW.commit() (if you are using trunk) or just
IW.close(), then look at the last IndexCommit passed to your deletion
policy's onCommit() and record yourself that this commit was the
result of an optimize.
Mike
Shalin Shekhar Mangar wrote:
> Hi,
>
> I'm implementing a custom IndexDeletionPolicy. An IndexCommit object
> does not have any information whether it's index is optimized or not.
> How can a IndexDeletionPolicy know which IndexCommit instances
> corresponded to optimized indices?
>
> --
> Regards,
> Shalin Shekhar Mangar.
>
> ---------------------------------------------------------------------
> 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
|