if we already have an idset, use it
This commit is contained in:
parent
f4c94a35d6
commit
4851ddde13
|
@ -72,10 +72,11 @@ public class FacetsPhase implements SearchPhase {
|
||||||
Filter facetFilter = new QueryWrapperFilter(queryFacet.query());
|
Filter facetFilter = new QueryWrapperFilter(queryFacet.query());
|
||||||
facetFilter = context.filterCache().cache(facetFilter);
|
facetFilter = context.filterCache().cache(facetFilter);
|
||||||
long count;
|
long count;
|
||||||
if (contextFacets.queryType() == SearchContextFacets.QueryExecutionType.COLLECT) {
|
// if we already have the doc id set, then use idset since its faster
|
||||||
count = executeQueryCollectorCount(context, queryFacet, facetFilter);
|
if (context.searcher().docIdSet() != null || contextFacets.queryType() == SearchContextFacets.QueryExecutionType.IDSET) {
|
||||||
} else if (contextFacets.queryType() == SearchContextFacets.QueryExecutionType.IDSET) {
|
|
||||||
count = executeQueryIdSetCount(context, queryFacet, facetFilter);
|
count = executeQueryIdSetCount(context, queryFacet, facetFilter);
|
||||||
|
} else if (contextFacets.queryType() == SearchContextFacets.QueryExecutionType.COLLECT) {
|
||||||
|
count = executeQueryCollectorCount(context, queryFacet, facetFilter);
|
||||||
} else {
|
} else {
|
||||||
throw new ElasticSearchIllegalStateException("No matching for type [" + contextFacets.queryType() + "]");
|
throw new ElasticSearchIllegalStateException("No matching for type [" + contextFacets.queryType() + "]");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue