jpountz commented on a change in pull request #857: LUCENE-8968: Improve 
performance of WITHIN and DISJOINT queries for Shape queries
URL: https://github.com/apache/lucene-solr/pull/857#discussion_r321276057
 
 

 ##########
 File path: lucene/sandbox/src/java/org/apache/lucene/document/ShapeQuery.java
 ##########
 @@ -235,17 +130,27 @@ public ScorerSupplier scorerSupplier(LeafReaderContext 
context) throws IOExcepti
           return null;
         }
 
-        boolean allDocsMatch = true;
-        if (values.getDocCount() != reader.maxDoc() ||
-            relateRangeToQuery(values.getMinPackedValue(), 
values.getMaxPackedValue(), queryRelation) != Relation.CELL_INSIDE_QUERY) {
-          allDocsMatch = false;
-        }
-
         final Weight weight = this;
-        if (allDocsMatch) {
+        Relation rel = relateRangeToQuery(values.getMinPackedValue(), 
values.getMaxPackedValue(), queryRelation);
+        if (rel == Relation.CELL_OUTSIDE_QUERY) {
+          // no documents match the query
           return new ScorerSupplier() {
             @Override
-            public Scorer get(long leadCost) throws IOException {
+            public Scorer get(long leadCost) {
+              return new ConstantScoreScorer(weight, score(), scoreMode, 
DocIdSetIterator.empty());
+            }
+
+            @Override
+            public long cost() {
+              return 0;
+            }
+          };
 
 Review comment:
   you can return a null ScorerSupplier in this case

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to