Apache Lucene open-source search software
LUCENE-10467: Throws IllegalArgumentException for getAllDims and getTopChildren if topN <= 0 (#751)
Yuting Gan6b82e600a8f8
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/Facets.java b/lucene/facet/src/java/org/apache/lucene/facet/Facets.javaindex 1c7572d9443..7ceb02518a7 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/Facets.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/Facets.java@@ -59,4 +59,16 @@ public abstract class Facets {List<FacetResult> allResults = getAllDims(topNChildren);return allResults.subList(0, Math.min(topNDims, allResults.size()));}++ /**+ * This helper method checks if topN is valid for getTopChildren and getAllDims. Throws+ * IllegalArgumentException if topN is invalid.+ *+ * @lucene.experimental it may not exist in future versions of Lucene+ */+ protected static void validateTopN(int topN) {+ if (topN <= 0) {+ throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");+ }+ }}diff --git a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.javaindex defef4449bb..82bf7d65ac4 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/LongValueFacetCounts.java@@ -348,6 +348,7 @@ public class LongValueFacetCounts extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) {+ validateTopN(topN);if (dim.equals(field) == false) {throw new IllegalArgumentException("invalid dim \"" + dim + "\"; should be \"" + field + "\"");@@ -489,6 +490,7 @@ public class LongValueFacetCounts extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) {+ validateTopN(topN);return Collections.singletonList(getTopChildren(topN, field));}diff --git a/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.javaindex e21fdc3e5d2..aa57013cada 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java@@ -42,6 +42,7 @@ public class MultiFacets extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {+ validateTopN(topN);Facets facets = dimToFacets.get(dim);if (facets == null) {if (defaultFacets == null) {@@ -66,7 +67,7 @@ public class MultiFacets extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {-+ validateTopN(topN);List<FacetResult> results = new ArrayList<FacetResult>();// First add the specific dim's facets:diff --git a/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.javaindex 4d51fed475c..fdb8fd49a9b 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java@@ -132,9 +132,7 @@ public class StringValueFacetCounts extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {- if (topN <= 0) {- throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");- }+ validateTopN(topN);if (dim.equals(field) == false) {throw new IllegalArgumentException("invalid dim \"" + dim + "\"; should be \"" + field + "\"");@@ -223,6 +221,7 @@ public class StringValueFacetCounts extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {+ validateTopN(topN);return Collections.singletonList(getTopChildren(topN, field));}diff --git a/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.javaindex fc376c5b0c7..3786fd089c2 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/range/RangeFacetCounts.java@@ -218,6 +218,7 @@ abstract class RangeFacetCounts extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) {+ validateTopN(topN);if (dim.equals(field) == false) {throw new IllegalArgumentException("invalid dim \"" + dim + "\"; should be \"" + field + "\"");@@ -240,6 +241,7 @@ abstract class RangeFacetCounts extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {+ validateTopN(topN);return Collections.singletonList(getTopChildren(topN, field));}diff --git a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.javaindex 8d9238cf07e..f2ef14254e4 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java@@ -98,10 +98,7 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {- if (topN <= 0) {- throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");- }-+ validateTopN(topN);FacetsConfig.DimConfig dimConfig = stateConfig.getDimConfig(dim);if (dimConfig.hierarchical) {@@ -411,7 +408,7 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {-+ validateTopN(topN);List<FacetResult> results = new ArrayList<>();for (String dim : state.getDims()) {FacetsConfig.DimConfig dimConfig = stateConfig.getDimConfig(dim);diff --git a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.javaindex 9de0cbaeb3e..e97ead7019e 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java@@ -103,10 +103,7 @@ public class SortedSetDocValuesFacetCounts extends Facets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {- if (topN <= 0) {- throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");- }-+ validateTopN(topN);FacetsConfig.DimConfig dimConfig = stateConfig.getDimConfig(dim);if (dimConfig.hierarchical) {@@ -197,7 +194,6 @@ public class SortedSetDocValuesFacetCounts extends Facets {*/private ChildOrdsResult getChildOrdsResult(PrimitiveIterator.OfInt childOrds, int topN, FacetsConfig.DimConfig dimConfig, int pathOrd) {-TopOrdAndIntQueue q = null;int bottomCount = 0;int dimCount = 0;@@ -484,6 +480,7 @@ public class SortedSetDocValuesFacetCounts extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {+ validateTopN(topN);List<FacetResult> results = new ArrayList<>();for (String dim : state.getDims()) {FacetResult factResult = getFacetResultForDim(dim, topN);@@ -512,9 +509,8 @@ public class SortedSetDocValuesFacetCounts extends Facets {@Overridepublic List<FacetResult> getTopDims(int topNDims, int topNChildren) throws IOException {- if (topNDims <= 0 || topNChildren <= 0) {- throw new IllegalArgumentException("topN must be > 0");- }+ validateTopN(topNDims);+ validateTopN(topNChildren);// Creates priority queue to store top dimensions and sort by their aggregated values/hits and// string values.diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.javaindex 60edf0f214e..fb1366e101a 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java@@ -89,9 +89,7 @@ abstract class FloatTaxonomyFacets extends TaxonomyFacets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {- if (topN <= 0) {- throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");- }+ validateTopN(topN);DimConfig dimConfig = verifyDim(dim);FacetLabel cp = new FacetLabel(dim, path);int dimOrd = taxoReader.getOrdinal(cp);diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.javaindex 1bde0eb798e..bfa4692697c 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java@@ -149,9 +149,7 @@ abstract class IntTaxonomyFacets extends TaxonomyFacets {@Overridepublic FacetResult getTopChildren(int topN, String dim, String... path) throws IOException {- if (topN <= 0) {- throw new IllegalArgumentException("topN must be > 0 (got: " + topN + ")");- }+ validateTopN(topN);DimConfig dimConfig = verifyDim(dim);FacetLabel cp = new FacetLabel(dim, path);int dimOrd = taxoReader.getOrdinal(cp);diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.javaindex 1f4e5cbe789..5e80485c86a 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java@@ -138,6 +138,7 @@ abstract class TaxonomyFacets extends Facets {@Overridepublic List<FacetResult> getAllDims(int topN) throws IOException {+ validateTopN(topN);int[] children = getChildren();int[] siblings = getSiblings();int ord = children[TaxonomyReader.ROOT_ORDINAL];diff --git a/lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java b/lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.javaindex 1fe741466e6..e68be0f5975 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java@@ -234,6 +234,13 @@ public class TestDrillSideways extends FacetTestCase {"dim=Size path=[] value=2 childCount=2\n Small (1)\n Medium (1)\n",concurrentResult.facets.getTopChildren(10, "Size").toString());+ // test getTopChildren(0, dim)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ concurrentResult.facets.getTopChildren(0, "Color");+ });+writer.close();IOUtils.close(searcher.getIndexReader(), taxoReader, taxoWriter, dir, taxoDir);}@@ -371,6 +378,14 @@ public class TestDrillSideways extends FacetTestCase {List<FacetResult> topDimsResults2 = r.facets.getTopDims(0, 1);assertEquals(0, topDimsResults2.size());+ // test getAllDims(0)+ DrillSidewaysResult finalR1 = r;+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ finalR1.facets.getAllDims(0);+ });+// More interesting case: drill-down on two fieldsddq = new DrillDownQuery(config);ddq.add("Author", "Lisa");@@ -456,6 +471,15 @@ public class TestDrillSideways extends FacetTestCase {assertEquals(0, r.hits.totalHits.value);assertNull(r.facets.getTopChildren(10, "Publish Date"));assertNull(r.facets.getTopChildren(10, "Author"));++ // test getTopChildren(0, dim)+ DrillSidewaysResult finalR = r;+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ finalR.facets.getTopChildren(0, "Author");+ });+writer.close();IOUtils.close(searcher.getIndexReader(), taxoReader, taxoWriter, dir, taxoDir);}@@ -1874,6 +1898,12 @@ public class TestDrillSideways extends FacetTestCase {"dim=Author path=[] value=5 childCount=4\n Lisa (2)\n Susan (1)\n",topNDimsResult.get(0).toString());+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });// More interesting case: drill-down on two fieldsddq = new DrillDownQuery(config);ddq.add("Author", "Lisa");diff --git a/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.javaindex ad0cd847891..eaf8d64634c 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/TestLongValueFacetCounts.java@@ -166,6 +166,12 @@ public class TestLongValueFacetCounts extends LuceneTestCase {// test getTopDims(0, 1)List<FacetResult> topDimsResults2 = facets.getTopDims(0, 1);assertEquals(0, topDimsResults2.size());+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });r.close();d.close();diff --git a/lucene/facet/src/test/org/apache/lucene/facet/TestStringValueFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/TestStringValueFacetCounts.javaindex b8d2abf9b85..ed0716201fd 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/TestStringValueFacetCounts.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/TestStringValueFacetCounts.java@@ -390,6 +390,13 @@ public class TestStringValueFacetCounts extends FacetTestCase {assertEquals(1, topNDimsResult.size());assertEquals(facetResult, topNDimsResult.get(0));+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+// This is a little strange, but we request all labels at this point so that when we// secondarily sort by label value in order to compare to the expected results, we have// all the values. See LUCENE-9991:diff --git a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.javaindex d807c23ec76..cdfdefd539b 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/range/TestRangeFacetCounts.java@@ -104,6 +104,13 @@ public class TestRangeFacetCounts extends FacetTestCase {"dim=field path=[] value=22 childCount=5\n less than 10 (10)\n less than or equal to 10 (11)\n over 90 (9)\n 90 or above (10)\n over 1000 (1)\n",result.toString());+ // test getTopChildren(0, dim)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getTopChildren(0, "field");+ });+r.close();d.close();}@@ -255,6 +262,13 @@ public class TestRangeFacetCounts extends FacetTestCase {List<FacetResult> topDimsResults2 = facets.getTopDims(0, 1);assertEquals(0, topDimsResults2.size());+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+r.close();d.close();}@@ -354,7 +368,6 @@ public class TestRangeFacetCounts extends FacetTestCase {assertEquals("dim=field path=[] value=41 childCount=4\n 0-10 (11)\n 10-20 (11)\n 20-30 (11)\n 30-40 (11)\n",result.toString());-r.close();d.close();}diff --git a/lucene/facet/src/test/org/apache/lucene/facet/sortedset/TestSortedSetDocValuesFacets.java b/lucene/facet/src/test/org/apache/lucene/facet/sortedset/TestSortedSetDocValuesFacets.javaindex 587fe24328b..80499b3d0f8 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/sortedset/TestSortedSetDocValuesFacets.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/sortedset/TestSortedSetDocValuesFacets.java@@ -140,6 +140,13 @@ public class TestSortedSetDocValuesFacets extends FacetTestCase {"dim=b path=[] value=2 childCount=2\n buzz (2)\n",topDimsResults1.get(0).toString());+ // test getTopDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+// DrillDown:DrillDownQuery q = new DrillDownQuery(config);q.add("a", "foo");@@ -351,7 +358,6 @@ public class TestSortedSetDocValuesFacets extends FacetTestCase {assertEquals("dim=c path=[buzz, bif] value=2 childCount=1\n baf (2)\n",facets.getTopChildren(10, "c", "buzz", "bif").toString());-// DrillDown:DrillDownQuery q = new DrillDownQuery(config);q.add("a", "foo");@@ -407,6 +413,14 @@ public class TestSortedSetDocValuesFacets extends FacetTestCase {"dim=a path=[] value=1 childCount=1\n bar (1)\n",facets.getTopChildren(10, "a").toString());+ // test topNChildren = 0+ Facets finalFacets = facets;+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ finalFacets.getTopChildren(0, "a");+ });+ExecutorService exec =new ThreadPoolExecutor(1,@@ -464,7 +478,6 @@ public class TestSortedSetDocValuesFacets extends FacetTestCase {assertEquals("dim=b path=[buzz] value=1 childCount=1\n baz (1)\n",facets.getTopChildren(10, "b", "buzz").toString());-ExecutorService exec =new ThreadPoolExecutor(1,@@ -1231,7 +1244,6 @@ public class TestSortedSetDocValuesFacets extends FacetTestCase {sortFacetResults(expected);List<FacetResult> actual = facets.getAllDims(10);-// Messy: fixup ties// sortTies(actual);diff --git a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.javaindex b2795989939..e46835cb349 100644--- a/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java+++ b/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetCounts.java@@ -112,6 +112,14 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {assertTrue(((TaxonomyFacets) facets).siblingsLoaded());assertTrue(((TaxonomyFacets) facets).childrenLoaded());+ // test getTopChildren(0, dim)+ Facets finalFacets = facets;+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ finalFacets.getTopChildren(0, "Author");+ });+// Retrieve & verify results:assertEquals("dim=Publish Date path=[] value=5 childCount=3\n 2010 (2)\n 2012 (2)\n 1999 (1)\n",@@ -194,6 +202,13 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {Facets facets =getAllFacets(FacetsConfig.DEFAULT_INDEX_FIELD_NAME, searcher, taxoReader, config);+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+// Ask for top 10 labels for any dims that have counts:List<FacetResult> results = facets.getAllDims(10);@@ -272,7 +287,6 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {// Ask for top 10 labels for any dims that have counts:List<FacetResult> results = facets.getAllDims(10);assertTrue(results.isEmpty());-expectThrows(IllegalArgumentException.class,() -> {@@ -468,6 +482,7 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {() -> {facets.getSpecificValue("dim");});+assertEquals(1, facets.getSpecificValue("dim2"));assertEquals(1, facets.getSpecificValue("dim3"));writer.close();@@ -644,6 +659,13 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {facets.getTopDims(1, 0);});+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+iw.close();IOUtils.close(taxoWriter, taxoReader, taxoDir, r, indexDir);}@@ -858,7 +880,6 @@ public class TestTaxonomyFacetCounts extends FacetTestCase {sortFacetResults(expected);List<FacetResult> actual = facets.getAllDims(10);-// Messy: fixup tiessortTies(actual);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.javaindex 9068129c941..ee9c9a20eb8 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@@ -120,6 +120,13 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {"dim=Author path=[] value=145.0 childCount=4\n Lisa (50.0)\n Frank (45.0)\n Susan (40.0)\n Bob (10.0)\n",facets.getTopChildren(10, "Author").toString());+ // test getTopChildren(0, dim)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getTopChildren(0, "Author");+ });+taxoReader.close();searcher.getIndexReader().close();dir.close();@@ -182,6 +189,13 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {// Ask for top 10 labels for any dims that have counts:List<FacetResult> results = facets.getAllDims(10);+ // test getAllDims(0)+ expectThrows(+ IllegalArgumentException.class,+ () -> {+ facets.getAllDims(0);+ });+assertEquals(3, results.size());assertEquals("dim=a path=[] value=60.0 childCount=3\n foo3 (30.0)\n foo2 (20.0)\n foo1 (10.0)\n",@@ -259,7 +273,6 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {// test default implementation of getTopDimsList<FacetResult> topDimsResults = facets.getTopDims(10, 10);assertTrue(topDimsResults.isEmpty());-expectThrows(IllegalArgumentException.class,() -> {@@ -336,7 +349,6 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {assertEquals("dim=a path=[] value=10.0 childCount=2\n 1 (6.0)\n 0 (4.0)\n",facets.getTopChildren(10, "a").toString());-iw.close();IOUtils.close(taxoWriter, taxoReader, taxoDir, r, indexDir);}@@ -375,7 +387,6 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {assertEquals("dim=a path=[] value=10.0 childCount=2\n 1 (6.0)\n 0 (4.0)\n",facets.getTopChildren(10, "a").toString());-iw.close();IOUtils.close(taxoWriter, taxoReader, taxoDir, r, indexDir);}@@ -409,7 +420,6 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {assertEquals("dim=a path=[] value=10.0 childCount=2\n 1 (6.0)\n 0 (4.0)\n",facets.getTopChildren(10, "a").toString());-iw.close();IOUtils.close(taxoWriter, taxoReader, taxoDir, r, indexDir);}@@ -537,13 +547,11 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {sortFacetResults(expected);List<FacetResult> actual = facets.getAllDims(10);-// test default implementation of getTopDimsif (actual.size() > 0) {List<FacetResult> topDimsResults1 = facets.getTopDims(1, 10);assertEquals(actual.get(0), topDimsResults1.get(0));}-// Messy: fixup tiessortTies(actual);