use of org.infinispan.query.clustered.QueryResponse in project infinispan by infinispan.
the class CQCreateEagerQuery method perform.
@Override
CompletionStage<QueryResponse> perform(BitSet segments) {
SearchQueryBuilder query = queryDefinition.getSearchQueryBuilder();
setFilter(segments);
CompletionStage<NodeTopDocs> nodeTopDocs = query.isEntityProjection() ? collectKeys(query) : collectProjections(query);
return nodeTopDocs.thenApply(QueryResponse::new);
}
use of org.infinispan.query.clustered.QueryResponse in project infinispan by infinispan.
the class CQDelete method perform.
@Override
CompletionStage<QueryResponse> perform(BitSet segments) {
setFilter(segments);
// Must never apply any kind of limits to a DELETE! Limits are just for paging a SELECT.
if (queryDefinition.getFirstResult() != 0 || queryDefinition.getMaxResults() != Integer.MAX_VALUE) {
throw CONTAINER.deleteStatementsCannotUsePaging();
}
SearchQueryBuilder query = queryDefinition.getSearchQueryBuilder();
return blockingManager.supplyBlocking(() -> fetchReferences(query), this).thenApply(queryResult -> queryResult.hits().stream().map(ref -> cache.remove(ref.key()) != null ? 1 : 0).reduce(0, Integer::sum)).thenApply(QueryResponse::new);
}
use of org.infinispan.query.clustered.QueryResponse in project infinispan by infinispan.
the class CQGetResultSize method perform.
@Override
CompletionStage<QueryResponse> perform(BitSet segments) {
SearchQueryBuilder query = queryDefinition.getSearchQueryBuilder();
setFilter(segments);
return blockingManager.supplyBlocking(() -> query.build().fetchTotalHitCount(), this).thenApply(hitCount -> new QueryResponse(Math.toIntExact(hitCount)));
}
Aggregations