iamsanjay commented on issue #13191: URL: https://github.com/apache/lucene/issues/13191#issuecomment-2006026200
`FloatTaxonomyFacets.getTopChildrenForPath` methods counts the children and apply the aggregate function for all the child nodes, only IF the child value is greater than 0. https://github.com/apache/lucene/blob/d393b9d03952c69d9641cd4a38bbe83939a25942/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java#L217-L227 On the test side, we have method which would prepare the expected result of aggregation, however, this time we don't filter child. https://github.com/apache/lucene/blob/d393b9d03952c69d9641cd4a38bbe83939a25942/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyFacetValueSource.java#L691-L700 Therefore, there is inconsistency between the number of child generated actual vs expected. Below can be a possible fix at the test level, assuming that the functionality of FloatTaxonomyFacets.getTopChildrenForPath behaves as intended. ``` List<FacetResult> expected = new ArrayList<>(); for (int i = 0; i < numDims; i++) { List<LabelAndValue> labelValues = new ArrayList<>(); float aggregatedValue = 0; for (Map.Entry<String, Float> ent : expectedValues[i].entrySet()) { if(ent.getValue() > 0) { labelValues.add(new LabelAndValue(ent.getKey(), ent.getValue())); aggregatedValue = aggregationFunction.aggregate(aggregatedValue, ent.getValue()); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org