nik9000 opened a new pull request #415: URL: https://github.com/apache/lucene/pull/415
# Description When we load a query into the query cache we always calculate the count of matching documents. This uses that count to power the new `O(1)` `Weight#count` method. # Solution I've tried a bunch of approaches but settled on opening this PR with the simplest one - add a new class that keeps the BitSet and the count. I'm not particularly tied to it other than that it is fairly simple. I am assuming it's right to try and implement `count` here rather than do something else. It feels like that method was made for situations like this though. # Tests I've added some to LRUCache's unit test. I haven't done any performance testing here. A little because "it's obvious that returning a number is faster than counting stuff". Nanoseconds vs microseconds. But I'd love to do more with this if folks want me to. # Checklist Please review the following and check all that apply: - [x] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/lucene/HowToContribute) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [ ] I have given Lucene maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended) - [ ] I have developed this patch against the `main` branch. - [x] I have run `./gradlew check`. - [x] I have added tests for my changes. -- 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