mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-12 07:55:24 +00:00
Lucene 8 has the ability to skip blocks of non-competitive documents. However some queries don't track their maximum score (`script_score`, `span`, ...) so they always return Float.POSITIVE_INFINITY as maximum score. This can slow down some boolean queries if other clauses have bounded max scores. This commit disables the max score optimization when we detect a mandatory scoring clause with unbounded max scores. Optional clauses are not checked since they can still skip documents when the unbounded clause is after the current document.