mikemccand commented on issue #12358: URL: https://github.com/apache/lucene/issues/12358#issuecomment-1585585299
> `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. Ahh -- gotchya -- only if the impl will be constant time is it allowed to run, else `-1` (also in constant time). OK so it's a bit tricky to add this opto to Lucene ... we need an API change of some sort. It's as if when `IndexSearcher.count` realizes it must fallback to counting each hit individually, it should then call maybe another API, which BQ would implement, to try to do that count more efficiently. Hmm. -- 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