// TODO clone store?
// TODO how to handle events while rebuilding clone?
for (Class<?> type : types) {
Esi4JRebuildSession rebuildSession = module.startRebuildSession(type);
try {
waitForGreenStatus(index);
findRebuildProcessor(rebuildSession).rebuild(index, rebuildSession);
// update metadata after succesful build
Object meta = rebuildSession.getMetadata();
if (meta != null) {
index.index(meta);
}
} finally {
rebuildSession.close();
}
}
// optimize index after rebuild