epotyom commented on code in PR #12862: URL: https://github.com/apache/lucene/pull/12862#discussion_r1420764333
########## lucene/facet/src/java/org/apache/lucene/facet/MultiFacets.java: ########## @@ -77,6 +80,39 @@ public Number getSpecificValue(String dim, String... path) throws IOException { return facets.getSpecificValue(dim, path); } + @Override + public Number[] getBulkSpecificValues(FacetLabel[] facetLabels) throws IOException { + if (facetLabels.length == 0) { + return new Number[0]; + } + // Split facetLabels into chunks by the Facets they belog to + Map<Facets, IntArrayList> labelsPerFacet = new HashMap<>(); + for (int i = 0; i < facetLabels.length; i++) { + String dim = facetLabels[i].components[0]; + Facets facets = dimToFacets.get(dim); + if (facets == null) { + if (defaultFacets == null) { + throw new IllegalArgumentException("invalid dim \"" + dim + "\""); + } + facets = defaultFacets; + } + labelsPerFacet.computeIfAbsent(facets, f -> new IntArrayList()).add(i); + } + // Call getBulkSpecificValues for each chunk and reconcile results + Number[] result = new Number[facetLabels.length]; + for (Map.Entry<Facets, IntArrayList> fl : labelsPerFacet.entrySet()) { + FacetLabel[] labelsForFacet = new FacetLabel[fl.getValue().size()]; + for (IntCursor ordI : fl.getValue()) { + labelsForFacet[ordI.index] = facetLabels[ordI.value]; + } + Number[] ords = fl.getKey().getBulkSpecificValues(labelsForFacet); Review Comment: It is because there are Facet implementations for integer and float values that share the same base class `Facets`. Oh, `ords` is a bad name for this variable - renamed. -- 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