jpountz commented on issue #12358: URL: https://github.com/apache/lucene/issues/12358#issuecomment-1584141294
> From my read of Lucene's BooleanWeight.count, I don't think Lucene has this optimization? Maybe we should port over Tantivy's optimization? It should make disjunctive counting quite a bit faster? `BooleanWeight#count` doesn't allow to do this kind of thing currently, because its contract is that it should run in constant-time or so, so that you can compute its result and then ignore it if you can't actually make use of it. E.g. for conjunctions, we call `BooleanWeight#count` over all clauses one by one and stop when more than one clause returns a results that is different from `numDocs`, and then we fall back to regular counting with TotalHitCountCollector. +1 to update the `Weight#count` API contract or introduce a new API to better optimize counting. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org