small optimization for global facet with facet filter, by removing the double check on the facet filter
This commit is contained in:
parent
f03ff2976a
commit
c33ca2921d
|
@ -48,6 +48,12 @@ public abstract class AbstractFacetCollector extends FacetCollector {
|
|||
return this.filter;
|
||||
}
|
||||
|
||||
public Filter getAndClearFilter() {
|
||||
Filter filter = this.filter;
|
||||
this.filter = null;
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(Filter filter) {
|
||||
if (this.filter == null) {
|
||||
|
|
|
@ -103,7 +103,9 @@ public class FacetPhase implements SearchPhase {
|
|||
if (collector instanceof AbstractFacetCollector) {
|
||||
AbstractFacetCollector facetCollector = (AbstractFacetCollector) collector;
|
||||
if (facetCollector.getFilter() != null) {
|
||||
filter = facetCollector.getFilter();
|
||||
// we can clear the filter, since we are anyhow going to iterate over it
|
||||
// so no need to double check it...
|
||||
filter = facetCollector.getAndClearFilter();
|
||||
}
|
||||
}
|
||||
List<Collector> list = filtersByCollector.get(filter);
|
||||
|
|
Loading…
Reference in New Issue