nfsantos commented on code in PR #2441:
URL: https://github.com/apache/jackrabbit-oak/pull/2441#discussion_r2267129954
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/facets/ElasticStatisticalFacetAsyncProvider.java:
##########
@@ -171,31 +179,28 @@ private void processAggregations(Map<String, Aggregate>
aggregations) {
private void computeStatisticalFacets() {
for (String facetKey : allFacets.keySet()) {
if (accessibleFacetCounts.containsKey(facetKey)) {
- Map<String, Integer> accessibleFacet =
accessibleFacetCounts.get(facetKey);
+ Map<String, MutableInt> accessibleFacet =
accessibleFacetCounts.get(facetKey);
List<FulltextIndex.Facet> uncheckedFacet =
allFacets.get(facetKey);
for (FulltextIndex.Facet facet : uncheckedFacet) {
if (accessibleFacet.containsKey(facet.getLabel())) {
- double sampleProportion = (double)
accessibleFacet.get(facet.getLabel()) / sampled;
+ double sampleProportion = (double)
accessibleFacet.get(facet.getLabel()).intValue() / sampled;
// returned count is the minimum between the
accessible count and the count computed from the sample
- accessibleFacet.put(facet.getLabel(),
Math.min(facet.getCount(), (int) (sampleProportion * totalHits)));
+ accessibleFacet.put(facet.getLabel(), new
MutableInt(Math.min(facet.getCount(), (int) (sampleProportion * totalHits))));
Review Comment:
Good catch. I have updated the logic with your suggestion.
--
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]