Skip to content

Commit

Permalink
ISPN-14189 Compute the size after a query
Browse files Browse the repository at this point in the history
Probably there is an issue on HSearch
  • Loading branch information
fax4ever authored and wburns committed May 19, 2023
1 parent e1ae46b commit 72fc8f0
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ public CompletionStage<Map<String, IndexInfo>> computeIndexInfos() {
private CompletionStage<IndexInfo> indexInfos(SearchIndexedEntity indexedEntity) {
SearchSession session = searchMapping.getMappingSession();
SearchScope<?> scope = session.scope(indexedEntity.javaClass(), indexedEntity.name());

CompletionStage<Long> countStage = blockingManager.supplyBlocking(
() -> session.search(scope).where(SearchPredicateFactory::matchAll).fetchTotalHitCount(), this);
CompletionStage<Long> sizeStage = indexedEntity.indexManager().unwrap(LuceneIndexManager.class)
.computeSizeInBytesAsync();
return countStage.thenCombine(sizeStage, IndexInfo::new);

return countStage
.thenCompose(count -> indexedEntity.indexManager().unwrap(LuceneIndexManager.class).computeSizeInBytesAsync()
.thenApply(size -> new IndexInfo(count, size)));
}

@Override
Expand Down

0 comments on commit 72fc8f0

Please sign in to comment.