From 887ac1fce6da06404bd5529f29398d0e90fd6cf0 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 28 Apr 2011 19:32:13 +0300 Subject: [PATCH] Search: Optimize (perf) execution of global facets, closes #889. --- .../java/org/elasticsearch/search/facet/FacetPhase.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetPhase.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetPhase.java index 0380c520aa7..c8d41e73d15 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetPhase.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetPhase.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.facet; import org.apache.lucene.search.*; import org.elasticsearch.ElasticSearchException; -import org.elasticsearch.common.collect.ImmutableList; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.collect.Maps; @@ -34,6 +33,7 @@ import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.query.QueryPhaseExecutionException; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -90,11 +90,10 @@ public class FacetPhase implements SearchPhase { } List list = filtersByCollector.get(filter); if (list == null) { - list = ImmutableList.of(collector); + list = new ArrayList(); filtersByCollector.put(filter, list); - } else { - list.add(collector); } + list.add(collector); } } // now, go and execute the filters->collector ones