use of com.b2international.index.admin.IndexAdmin in project snow-owl by b2ihealthcare.
the class RepositoryTransactionContext method clearContents.
@Override
public void clearContents() {
final Index index = service(Index.class);
final RevisionSearcher revisionSearcher = service(RevisionSearcher.class);
final IndexAdmin indexAdmin = index.admin();
final Mappings mappings = indexAdmin.mappings();
final Stream<Class<?>> revisionTypes = mappings.getTypes().stream().filter(t -> Revision.class.isAssignableFrom(t));
revisionTypes.forEach(type -> {
Query.select(String.class).from(type).fields(Revision.Fields.ID).where(Expressions.matchAll()).build().stream(revisionSearcher).forEachOrdered(ids -> {
final Iterable<?> revisions = fetchComponents(ids.getHits(), type);
revisions.forEach(rev -> {
final String revisionId = ((Revision) rev).getId();
staging.stageRemove(revisionId, rev);
});
});
});
}
Aggregations