Skip to content

Commit

Permalink
Fixing minor bugs in refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Ankit Jain <[email protected]>
  • Loading branch information
jainankitk committed Nov 17, 2023
1 parent 449e394 commit b2d2606
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
final PointRangeQuery prq = (PointRangeQuery) cq;
// Ensure that the query and aggregation are on the same field
if (prq.getField().equals(fieldName)) {
FilterRewriteHelper.createFilterForAggregations(
aggregationContext,
filters = FilterRewriteHelper.createFilterForAggregations(
context,
rounding,
preparedRounding,
fieldName,
Expand All @@ -138,7 +138,7 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
);
}
} else if (cq instanceof MatchAllDocsQuery) {
FilterRewriteHelper.findBoundsAndCreateFilters(context, rounding, preparedRounding, fieldName);
filters = FilterRewriteHelper.findBoundsAndCreateFilters(context, rounding, preparedRounding, fieldName);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static Query unwrapIntoConcreteQuery(Query query) {
* Finds the min and max bounds for segments within the passed search context
* and creates the weight filters using range queries within those bounds
*/
public static void findBoundsAndCreateFilters(
public static Weight[] findBoundsAndCreateFilters(
final SearchContext context,
final Rounding rounding,
final Rounding.Prepared preparedRounding,
Expand All @@ -79,7 +79,8 @@ public static void findBoundsAndCreateFilters(
min = Math.min(min, NumericUtils.sortableBytesToLong(leaf.reader().getPointValues(fieldName).getMinPackedValue(), 0));
max = Math.max(max, NumericUtils.sortableBytesToLong(leaf.reader().getPointValues(fieldName).getMaxPackedValue(), 0));
}
createFilterForAggregations(context, rounding, preparedRounding, fieldName, min, max);
System.out.println("Auto min and max for aggregation are : " + min + " : " + max);
return createFilterForAggregations(context, rounding, preparedRounding, fieldName, min, max);
}

/**
Expand Down

0 comments on commit b2d2606

Please sign in to comment.