romseygeek commented on code in PR #15741:
URL: https://github.com/apache/lucene/pull/15741#discussion_r2834168657
##########
lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java:
##########
@@ -1071,6 +1071,72 @@ private void testStringSortOptimizationWithMissingValues(
dir.close();
}
+ public void testStringSortOptimizationFieldMissingInSegmentBasedPostings()
throws IOException {
+ testStringSortOptimizationFieldMissingInSegment(
+ (field, value) -> new KeywordField(field, value, Field.Store.NO));
+ }
+
+ public void testStringSortOptimizationFieldMissingInSegmentBasedDVSkipper()
throws IOException {
+
testStringSortOptimizationFieldMissingInSegment(SortedDocValuesField::indexedField);
+ }
+
+ /**
+ * Test that when a segment doesn't contain the sort field at all (fieldInfo
== null), the
+ * optimization still works. All docs in such a segment have missing values,
and when missing
+ * values are non-competitive the entire segment should be skippable.
+ */
Review Comment:
I tried to assert that no pruning happens, but it seems it can still do some
pruning on the earlier segment. So instead I added test cases that run the
query with pruning enabled and disabled and asserted that the results are the
same.
--
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]