jpountz commented on a change in pull request #286:
URL: https://github.com/apache/lucene/pull/286#discussion_r704166498



##########
File path: lucene/core/src/java/org/apache/lucene/search/SortField.java
##########
@@ -606,4 +609,20 @@ public IndexSorter getIndexSorter() {
         return null;
     }
   }
+
+  /**
+   * Disable numeric sort optimization. By default sorting on a numeric field 
activates sort
+   * optimization that can efficiently skip non-competitive hits. Sort 
optimization has a number of
+   * requirements, one of which is that SortField.Type matches the Point type 
with which the field
+   * was indexed (e.g. sort on IntPoint field should use SortField.Type.INT).
+   *
+   * <p>This allows to disable sort optimization, in cases where these 
requirements can't be met.
+   */
+  public void disableSortOptimization() {
+    this.sortOptimizationDisabled = true;
+  }
+
+  protected boolean sortOptimizationDisabled() {
+    return sortOptimizationDisabled;
+  }

Review comment:
       I think we should be more specific regarding what optimization we are 
talking about. Maybe call it something like `pointSortOptimization` and update 
javadocs to say something like `Disable numeric sort optimization to use the 
Points index to skip over non-competitive documents`?

##########
File path: lucene/core/src/java/org/apache/lucene/search/SortField.java
##########
@@ -606,4 +609,20 @@ public IndexSorter getIndexSorter() {
         return null;
     }
   }
+
+  /**
+   * Disable numeric sort optimization. By default sorting on a numeric field 
activates sort
+   * optimization that can efficiently skip non-competitive hits. Sort 
optimization has a number of
+   * requirements, one of which is that SortField.Type matches the Point type 
with which the field
+   * was indexed (e.g. sort on IntPoint field should use SortField.Type.INT).
+   *
+   * <p>This allows to disable sort optimization, in cases where these 
requirements can't be met.
+   */
+  public void disableSortOptimization() {

Review comment:
       I wonder if we should mark it `@Deprecated` and highlight in javadocs 
that this should only be used for compatibility with 8.x indices that got 
created with inconsistent data across fields, or the wrong sort configuration 
in the index sort?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to