You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/09/25 05:41:31 UTC

[GitHub] [lucene] shaie commented on a diff in pull request #11768: Fix tie-break bug in various Facets implementations

shaie commented on code in PR #11768:
URL: https://github.com/apache/lucene/pull/11768#discussion_r979357774


##########
lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java:
##########
@@ -189,10 +190,11 @@ private TopChildrenForPath getTopChildrenForPath(DimConfig dimConfig, int pathOr
 
     TopOrdAndFloatQueue.OrdAndValue reuse = null;
     while (ord != TaxonomyReader.INVALID_ORDINAL) {
-      if (values[ord] > 0) {
+      float value = values[ord];
+      if (value > 0) {
         aggregatedValue = aggregationFunction.aggregate(aggregatedValue, values[ord]);

Review Comment:
   nit: might as well use `value` here too (and check if we you can replace `values[ord]` with `value` elsewhere



##########
lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java:
##########
@@ -626,7 +626,7 @@ public void testBasicWithCollectorManager() throws Exception {
     List<FacetResult> topNDimsResult = r.facets.getTopDims(1, 2);
     assertEquals(1, topNDimsResult.size());
     assertEquals(
-        "dim=Author path=[] value=5 childCount=4\n  Lisa (2)\n  Susan (1)\n",

Review Comment:
   It's disturbing that these tests were "wrong" and we just let them be like that. I'm glad that you fixed them, but makes me wonder if it was possible to catch this bug earlier by scrutinizing these tests better.



-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org