mirror of https://github.com/apache/lucene.git
LUCENE-10529: Fix TestTaxonomyFacetAssociations NPE when randomly indexing no documents for dim
This commit is contained in:
parent
2a618586de
commit
f11468186a
|
@ -149,6 +149,9 @@ Bug Fixes
|
|||
|
||||
* LUCENE-10533: SpellChecker.formGrams is missing bounds check (Kevin Risden)
|
||||
|
||||
* LUCENE-10529: Properly handle when TestTaxonomyFacetAssociations test case randomly indexes
|
||||
no documents instead of throwing an NPE. (Greg Miller)
|
||||
|
||||
Build
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -427,9 +427,16 @@ public class TestTaxonomyFacetAssociations extends FacetTestCase {
|
|||
}
|
||||
|
||||
FacetResult facetResult = facets.getTopChildren(10, dim);
|
||||
assertEquals(dim, facetResult.dim);
|
||||
assertEquals(aggregatedValue, facetResult.value.intValue());
|
||||
assertEquals(expected.size(), facetResult.childCount);
|
||||
|
||||
if (expected.isEmpty()) {
|
||||
// If we hit the rare random case where nothing is indexed for the dim, we expect a null
|
||||
// facetResult (see: LUCENE-10529)
|
||||
assertNull(facetResult);
|
||||
} else {
|
||||
assertEquals(dim, facetResult.dim);
|
||||
assertEquals(aggregatedValue, facetResult.value.intValue());
|
||||
assertEquals(expected.size(), facetResult.childCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateFloats(
|
||||
|
@ -451,8 +458,15 @@ public class TestTaxonomyFacetAssociations extends FacetTestCase {
|
|||
}
|
||||
|
||||
FacetResult facetResult = facets.getTopChildren(10, dim);
|
||||
assertEquals(dim, facetResult.dim);
|
||||
assertEquals(aggregatedValue, facetResult.value.floatValue(), 1);
|
||||
assertEquals(expected.size(), facetResult.childCount);
|
||||
|
||||
if (expected.isEmpty()) {
|
||||
// If we hit the rare random case where nothing is indexed for the dim, we expect a null
|
||||
// facetResult (see: LUCENE-10529)
|
||||
assertNull(facetResult);
|
||||
} else {
|
||||
assertEquals(dim, facetResult.dim);
|
||||
assertEquals(aggregatedValue, facetResult.value.floatValue(), 1);
|
||||
assertEquals(expected.size(), facetResult.childCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue