From 9cc0b7a28b5a58531d38a83d7276c3779c4a3354 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Thu, 10 Nov 2011 18:27:11 -0500 Subject: [PATCH] Fix processing of regex patterns in large terms facet requests --- .../strings/TermsStringOrdinalsFacetCollector.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetCollector.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetCollector.java index ba0a2ec90a0..66c23f9da28 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetCollector.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/terms/strings/TermsStringOrdinalsFacetCollector.java @@ -211,10 +211,14 @@ public class TermsStringOrdinalsFacetCollector extends AbstractFacetCollector { } while (agg != null && value.equals(agg.current)); if (count > minCount) { - if (excluded == null || !excluded.contains(value)) { - InternalStringTermsFacet.StringEntry entry = new InternalStringTermsFacet.StringEntry(value, count); - ordered.add(entry); + if (excluded != null && excluded.contains(value)) { + continue; } + if (matcher != null && !matcher.reset(value).matches()) { + continue; + } + InternalStringTermsFacet.StringEntry entry = new InternalStringTermsFacet.StringEntry(value, count); + ordered.add(entry); } }