Hello,
I came across the following problem.
The result of the optimize work seems to be commited to the index only when the SessionFactory is closed - see ExclusiveIndexWorkspaceImpl.afterTransactionApplied with stream work bellow.
Code:
public class ExclusiveIndexWorkspaceImpl extends AbstractWorkspaceImpl {
public ExclusiveIndexWorkspaceImpl(DirectoryBasedIndexManager indexManager, WorkerBuildContext context, Properties cfg) {
super( indexManager, context, cfg );
}
@Override
public void afterTransactionApplied(boolean someFailureHappened, boolean streaming) {
if ( someFailureHappened ) {
writerHolder.forceLockRelease();
}
else {
if ( ! streaming ) {
writerHolder.commitIndexWriter();
}
}
}
...
In my context, all my batch jobs (technical and business) are SpringBatch ones deployed in JBoss EAP.
So to be homogeneous with all my applications, I wrap tasks like mass indexing or index optimizing in SpringBatch tasklet deployed in JBoss EAP. But with my problem on commit, result of optimize is only "visible" when my web app is disabled/enabled.
Is there a way to get the behaviour I expect ?
Thanks