Index: lucene/CHANGES.txt =================================================================== --- lucene/CHANGES.txt (revision 1464915) +++ lucene/CHANGES.txt (working copy) @@ -188,6 +188,9 @@ with target<=current (in this case the behavior of advance is undefined). (Adrien Grand) +* LUCENE-4913: FacetResultNode.ordinal was always 0 for ALL_PARENTS + when all children are returned (Mike McCandless) + Documentation * LUCENE-4841: Added example SimpleSortedSetFacetsExample to show how Index: lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java =================================================================== --- lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java (revision 1464915) +++ lucene/facet/src/test/org/apache/lucene/facet/search/TestDemoFacets.java (working copy) @@ -203,7 +203,7 @@ FacetSearchParams fsp = new FacetSearchParams(fip, new CountFacetRequest(new CategoryPath("a", '/'), 10)); - // Aggregatses the facet counts: + // Aggregate the facet counts: FacetsCollector c = FacetsCollector.create(fsp, searcher.getIndexReader(), taxoReader); // MatchAllDocsQuery is for "browsing" (counts facets @@ -215,6 +215,11 @@ assertEquals(1, results.size()); assertEquals(1, (int) results.get(0).getFacetResultNode().value); + // LUCENE-4913: + for(FacetResultNode childNode : results.get(0).getFacetResultNode().subResults) { + assertTrue(childNode.ordinal != 0); + } + searcher.getIndexReader().close(); taxoReader.close(); dir.close(); Index: lucene/facet/src/java/org/apache/lucene/facet/search/IntFacetResultsHandler.java =================================================================== --- lucene/facet/src/java/org/apache/lucene/facet/search/IntFacetResultsHandler.java (revision 1464915) +++ lucene/facet/src/java/org/apache/lucene/facet/search/IntFacetResultsHandler.java (working copy) @@ -65,9 +65,8 @@ while (ordinal != TaxonomyReader.INVALID_ORDINAL) { int value = values[ordinal]; if (value > 0) { - FacetResultNode node = new FacetResultNode(); + FacetResultNode node = new FacetResultNode(ordinal, value); node.label = taxonomyReader.getPath(ordinal); - node.value = value; nodes.add(node); } ordinal = siblings[ordinal];