gsmiller commented on a change in pull request #611:
URL: https://github.com/apache/lucene/pull/611#discussion_r789158426



##########
File path: 
lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java
##########
@@ -121,12 +124,26 @@ public FacetResult getTopChildren(int topN, String dim, 
String... path) throws I
         // means dimension was never indexed
         return null;
       }
-      return getDim(dim, null, -1, ordRange.iterator(), topN);
+      int dimOrd = ordRange.start;
+      PrimitiveIterator.OfInt childIt = ordRange.iterator();
+      if (dimConfig.multiValued && dimConfig.requireDimCount) {
+        // If the dim is multi-valued and requires dim counts, we know we've 
explicitly indexed
+        // the dimension and we need to skip past it so the iterator is 
positioned on the first
+        // child:
+        childIt.next();
+      }
+      return getDim(dimConfig, dimOrd, dim, null, -1, childIt, topN);
     }
   }
 
   private FacetResult getDim(
-      String dim, String[] path, int pathOrd, PrimitiveIterator.OfInt 
childOrds, int topN)
+      FacetsConfig.DimConfig dimConfig,
+      int dimOrd,

Review comment:
       Makes sense! Thanks for the suggestion.

##########
File path: lucene/facet/src/java/org/apache/lucene/facet/FacetsConfig.java
##########
@@ -494,10 +498,16 @@ private void processSSDVFacetFields(
                     + facetField.path.length
                     + " components");
           }
+          if (dimConfig.multiValued && dimConfig.requireDimCount) {
+            // If non-hierarchical but multi-valued and requiring dim count, 
make sure to
+            // explicitly index the dimension so we can get accurate counts 
for it:
+            String dimString = pathToString(facetLabel.components, 1);

Review comment:
       Doh, yep. Thanks!




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to