epotyom commented on PR #15998: URL: https://github.com/apache/lucene/pull/15998#issuecomment-4533877597
This change seem to introduce a hidden API contract change. IIUC currently, `ScorerSupplier#cost` has no requirement that cost must be 0 **only** when there are no matching docs in the segment - but with this change it effectively becomes one? That seems risky. Ideally, when a clause matches no terms in a segment, the `ScorerSupplier` for it should be `null`. In that case `BooleanWeight` can already optimize - e.g. if a required clause returns `null` ScorerSupplier for a segment, the whole boolean query can skip that segment, which might cover your case. There was a bug in `TermQuery` where `ScorerSupplier` was non-null even when the term wasn't present in the segment; #15627 fixed this for the non-prefetch (hot index) path by making `TermStates.get()` return null directly instead of deferring to a lambda. I'm curious whether that covered your use case? If not, it would be worth looking at profiler snapshots to understand which lower-level operation is expensive. -- 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]
