From 67876b30277314f15f5e55ef321a39d67e7f1bac Mon Sep 17 00:00:00 2001 From: yonik Date: Sun, 4 Jun 2017 20:13:25 -0400 Subject: [PATCH] SOLR-7452: fix facet refinement for method:dvhash --- .../src/java/org/apache/solr/search/facet/FacetField.java | 7 ++++++- .../apache/solr/search/facet/TestJsonFacetRefinement.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetField.java b/solr/core/src/java/org/apache/solr/search/facet/FacetField.java index e8e624cbae3..42f791c4268 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/FacetField.java +++ b/solr/core/src/java/org/apache/solr/search/facet/FacetField.java @@ -98,7 +98,12 @@ public class FacetField extends FacetRequestSorted { FieldType ft = sf.getType(); boolean multiToken = sf.multiValued() || ft.multiValuedFieldCache(); - NumberType ntype = ft.getNumberType(); + if (fcontext.facetInfo != null) { + // refinement... we will end up either skipping the entire facet, or doing calculating only specific facet buckets + return new FacetFieldProcessorByArrayDV(fcontext, this, sf); + } + + NumberType ntype = ft.getNumberType(); // ensure we can support the requested options for numeric faceting: if (ntype != null) { if (prefix != null) { diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetRefinement.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetRefinement.java index e0b18657488..9087d30a241 100644 --- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetRefinement.java +++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacetRefinement.java @@ -238,7 +238,7 @@ public class TestJsonFacetRefinement extends SolrTestCaseHS { ModifiableSolrParams p = params("cat_s", "cat_s", "xy_s", "xy_s", "num_d", "num_d", "qw_s", "qw_s", "er_s","er_s"); doBasicRefinement( p ); - p.set("terms","method:dv,"); + p.set("terms","method:dvhash,"); doBasicRefinement( p ); // multi-valued strings