jpountz commented on code in PR #14560:
URL: https://github.com/apache/lucene/pull/14560#discussion_r2063582045


##########
lucene/sandbox/src/java/org/apache/lucene/sandbox/facet/plain/histograms/HistogramCollector.java:
##########
@@ -330,4 +333,23 @@ static void checkMaxBuckets(int size, int maxBuckets) {
   public void setWeight(Weight weight) {
     this.weight = weight;
   }
+
+  private boolean isMatchAll(LeafReaderContext context) throws IOException {
+    return weight != null && weight.count(context) == 
context.reader().maxDoc();
+  }
+
+  private PointRangeQuery getPointRangeQuery(final String field) {
+    if (weight == null || weight.getQuery() == null) {
+      return null;
+    }
+
+    if (weight.getQuery() instanceof PointRangeQuery) {

Review Comment:
   Nit: you could use more modern syntax since `main` requires Java 21 now.
   
   ```suggestion
       if (weight.getQuery() instanceof PointRangeQuery prq) {
   ```



##########
lucene/sandbox/src/java/org/apache/lucene/sandbox/facet/plain/histograms/HistogramCollector.java:
##########
@@ -330,4 +333,23 @@ static void checkMaxBuckets(int size, int maxBuckets) {
   public void setWeight(Weight weight) {
     this.weight = weight;
   }
+
+  private boolean isMatchAll(LeafReaderContext context) throws IOException {
+    return weight != null && weight.count(context) == 
context.reader().maxDoc();
+  }
+
+  private PointRangeQuery getPointRangeQuery(final String field) {
+    if (weight == null || weight.getQuery() == null) {
+      return null;
+    }
+

Review Comment:
   You'll probably want to remove layers of queries that don't affect matches, 
e.g. BoostQuery, ConstantScoreQuery, IndexOrDocValuesQuery, before doing the 
instanceof check. Especially as PointRangeQuery is often wrapped in an 
IndexOrDocValuesQuery.



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

Reply via email to