Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-8686: Fix test bug in TestTaxonomyFacetSumValueSource#testRandom

jimczi4625270ce093
diff --git a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetSumValueSource.java b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetSumValueSource.java
index 76493ed1b61..b686d92290d 100644
--- a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetSumValueSource.java
+++ b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetSumValueSource.java
@@ -452,8 +452,10 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {
List<LabelAndValue> labelValues = new ArrayList<>();
double totValue = 0;
for(Map.Entry<String,Float> ent : expectedValues[i].entrySet()) {
- labelValues.add(new LabelAndValue(ent.getKey(), ent.getValue()));
- totValue += ent.getValue();
+ if (ent.getValue() > 0) {
+ labelValues.add(new LabelAndValue(ent.getKey(), ent.getValue()));
+ totValue += ent.getValue();
+ }
}
sortLabelValues(labelValues);
if (totValue > 0) {