private void beforeBatch ( BatchBackend backend ) { if ( this . purgeAtStart ) { // purgeAll for affected entities IndexedTypeSet targetedTypes = searchFactoryImplementor . getIndexedTypesPolymorphic ( rootIndexedTypes ) ; for ( IndexedTypeIdentifier type : targetedTypes ) { // needs do be in-sync work to make sure we wait for the end of it. backend . doWorkInSync ( new PurgeAllLuceneWork ( tenantId , type ) ) ; } if ( this . optimizeAfterPurge ) { backend . optimize ( targetedTypes ) ; } } }
Optional operations to do before the multiple - threads start indexing