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



##########
File path: lucene/core/src/java/org/apache/lucene/search/SortField.java
##########
@@ -130,6 +130,9 @@
   // Used for 'sortMissingFirst/Last'
   protected Object missingValue = null;
 
+  // Indicates if numeric sort optimization is disabled. Enabled by default.
+  private boolean pointSortOptimizationDisabled = false;

Review comment:
       Can we make this "positive" to avoid double negatives? I suggest 
`private boolean optimizePoints = true;` It should also be deprecated.

##########
File path: lucene/core/src/java/org/apache/lucene/search/SortField.java
##########
@@ -606,4 +609,26 @@ public IndexSorter getIndexSorter() {
         return null;
     }
   }
+
+  /**
+   * Disable numeric sort optimization to use the Points index to skip over 
non-competitive
+   * documents. By default sorting on a numeric field activates point 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). Another requirement is 
that the same data is
+   * indexed with points and doc values for the field.
+   *
+   * <p>This allows to disable sort optimization, in cases where these 
requirements can't be met.
+   *
+   * @deprecated 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
+   */
+  @Deprecated // Remove in Lucene 9
+  public void disablePointSortOptimization() {
+    this.pointSortOptimizationDisabled = true;
+  }
+
+  protected boolean pointSortOptimizationDisabled() {

Review comment:
       Can we make this an ordinary getter? I suggest `getOptimizePoints()`. It 
should be deprecated and public IMO.

##########
File path: lucene/core/src/java/org/apache/lucene/search/SortField.java
##########
@@ -606,4 +609,26 @@ public IndexSorter getIndexSorter() {
         return null;
     }
   }
+
+  /**
+   * Disable numeric sort optimization to use the Points index to skip over 
non-competitive
+   * documents. By default sorting on a numeric field activates point 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). Another requirement is 
that the same data is
+   * indexed with points and doc values for the field.
+   *
+   * <p>This allows to disable sort optimization, in cases where these 
requirements can't be met.
+   *
+   * @deprecated 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
+   */
+  @Deprecated // Remove in Lucene 9
+  public void disablePointSortOptimization() {
+    this.pointSortOptimizationDisabled = true;
+  }

Review comment:
       Can we make this an ordinary setter? I suggest 
`setOptimizePoints(boolean)`.




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