serhiy-bzhezytskyy commented on issue #12370:
URL: https://github.com/apache/lucene/issues/12370#issuecomment-5035665408

   I put up a PR for this: #16411.
   
   Root cause: when the sort field is missing from the whole index, every doc 
ties on the missing value, so with no tie-breaker the remaining docs are 
non-competitive once the top-N queue is full — but `TermOrdValComparator` 
didn't recognize that and scanned every document. The PR mirrors the existing 
`singleSort` competitive-iterator recognition to the `minOrd` path (gated on 
`bottomValue == null`) so it early-terminates. Results are unchanged; it's 
purely an optimization, with a regression test in `TestSortOptimization`.
   
   Happy to adjust the approach if there's a preferred way to handle it.
   


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