use of com.enonic.xp.node.SearchMode in project xp by enonic.
the class SearchExecutor method execute.
public SearchResult execute(final SearchRequest searchRequest) {
final ElasticsearchQuery query = ESQueryTranslator.translate(searchRequest);
final SearchMode searchMode = query.getSearchMode();
final int size = query.getSize();
final boolean anyAggregations = !query.getAggregations().isEmpty();
if (searchMode.equals(SearchMode.COUNT)) {
return CountExecutor.create(this.client).build().execute(query);
}
if (size == NodeSearchService.GET_ALL_SIZE_FLAG) {
if (anyAggregations) {
LOG.debug("Query with size [" + query.getSize() + "] > threshold [" + SCROLL_THRESHOLD + "] but with aggregations. Scan not possible.");
} else {
return ScrollExecutor.create(this.client).build().execute(query);
}
}
return doSearch(query);
}
Aggregations