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/03/03 20:39:44 UTC

[GitHub] [lucene] msokolov commented on a change in pull request #718: LUCENE-10444: Support alternate aggregation functions in association facets

msokolov commented on a change in pull request #718:
URL: https://github.com/apache/lucene/pull/718#discussion_r819043542



##########
File path: lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java
##########
@@ -173,17 +185,17 @@ public FacetResult getTopChildren(int topN, String dim, String... path) throws I
 
     if (sparseValues != null) {
       for (IntIntCursor c : sparseValues) {
-        int count = c.value;
+        int value = c.value;
         int ord = c.key;
-        if (parents[ord] == dimOrd && count > 0) {
-          totValue += count;
+        if (parents[ord] == dimOrd && value > 0) {
+          aggregatedValue = aggregationFunction.aggregate(aggregatedValue, value);
           childCount++;
-          if (count > bottomValue) {
+          if (value > bottomValue) {

Review comment:
       I guess we need to ensure that aggregation functions are nondecreasing? I mean `min` wouldn't work very well here

##########
File path: lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java
##########
@@ -130,16 +140,16 @@ public FacetResult getTopChildren(int topN, String dim, String... path) throws I
       ord = siblings[ord];
     }
 
-    if (sumValues == 0) {
+    if (aggregatedValue == 0) {
       return null;
     }
 
     if (dimConfig.multiValued) {
       if (dimConfig.requireDimCount) {
-        sumValues = values[dimOrd];
+        aggregatedValue = values[dimOrd];
       } else {
         // Our sum'd count is not correct, in general:

Review comment:
       our "aggregated" count?




-- 
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