New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LUCENE-10395: Introduce TotalHitCountCollectorManager #622
Conversation
…archer#search(Query, Collector) usages
new MatchAllDocsQuery(), | ||
MultiCollector.wrap(totalHitCount, new DocValuesStatsCollector(stats))); | ||
|
||
searcher.search(new MatchAllDocsQuery(), new DocValuesStatsCollector(stats)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am possibly missing something here: two collectors were used, but the total hits were never retrieved from the total hit count collector. Removing its usage seems ok according to tests. Is this ok to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good question. I think so, but would like @gsmiller to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also revert this bit for now if we are not sure, this change is not strictly needed and I will encounter it again soon when trying to get rid of usages of the search method that takes a collector as argument
lucene/misc/src/test/org/apache/lucene/misc/search/TestMemoryAccountingBitsetCollector.java
Show resolved
Hide resolved
lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollectorManager.java
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
Outdated
Show resolved
Hide resolved
new MatchAllDocsQuery(), | ||
MultiCollector.wrap(totalHitCount, new DocValuesStatsCollector(stats))); | ||
|
||
searcher.search(new MatchAllDocsQuery(), new DocValuesStatsCollector(stats)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good question. I think so, but would like @gsmiller to confirm.
lucene/misc/src/test/org/apache/lucene/misc/search/TestMemoryAccountingBitsetCollector.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, can you add an entry to the changelog about this new addition under version 9.1?
lucene/core/src/test/org/apache/lucene/search/TestLRUQueryCache.java
Outdated
Show resolved
Hide resolved
Sure! I see that in the changelog I need to specify the lucene issue, and this one was developed under LUCENE-10002 which is though not completed with this PR. Maybe it makes sense that I create a specific lucene issue for this addition then? |
+1 |
This should be ready now ;) |
This commit introduces TotalHitCountCollectorManager and replaces some more IndexSearcher#search(Query, Collector) usages with its corresponding variant that accepts a CollectorManager. Places where TotalHitCountCollector was used as the only collector, which are not replaced with IndexSearcher#count as part of #612, are migrated so that they use the newly introduced TotalHitCountCollectorManager instead.
This is another one of the many steps required to resolve LUCENE-10002
main
branch../gradlew check
.