File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
server/src/main/java/org/elasticsearch/lucene/comparators Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,12 @@ protected int docCount() {
357357 * @throws IOException i/o exception while fetching min and max values from point values
358358 */
359359 void postInitializeCompetitiveIterator () throws IOException {
360- if (queueFull ) {
360+ if (queueFull && hitsThresholdReached ) {
361+ // if some documents have missing doc values, check that missing values prohibits
362+ // optimization
363+ if (docCount () < maxDoc && isMissingValueCompetitive ()) {
364+ return ;
365+ }
361366 long bottom = leafComparator .bottomAsComparableLong ();
362367 long minValue = sortableBytesToLong (pointValues .getMinPackedValue ());
363368 long maxValue = sortableBytesToLong (pointValues .getMaxPackedValue ());
@@ -509,7 +514,12 @@ protected int docCount() {
509514 * iterator as competitive iterator.
510515 */
511516 void postInitializeCompetitiveIterator () {
512- if (queueFull ) {
517+ if (queueFull && hitsThresholdReached ) {
518+ // if some documents have missing doc values, check that missing values prohibits
519+ // optimization
520+ if (docCount () < maxDoc && isMissingValueCompetitive ()) {
521+ return ;
522+ }
513523 long bottom = leafComparator .bottomAsComparableLong ();
514524 if (reverse == false && bottom < skipper .minValue ()) {
515525 competitiveIterator .update (DocIdSetIterator .empty ());
You can’t perform that action at this time.
0 commit comments