uschindler commented on PR #2221: URL: https://github.com/apache/solr/pull/2221#issuecomment-1915232387
Hi, I already responded on Slack, but I now found this PR and wanted to say some additional things: There is also a separate collector and on top of that a separate method in `IndexSearcher`, which automatically does a lot of the top-docs related stuff. The problem with a normal `TopDocs` or `TopFieldDocs` collector is that the empty PQ has some additional overhead (although the score is not calculated and returned as 0). First of all: SolrIndexSearcher should also implement support for using the optimized methods and collectors, unless a `DocSet` is needed (for facets/aggs). Using the `TotalHitCountCollector` is one thing to do (this needs to be done more down the line in the search code of Solr, but it's worth to do. But as there is now support to short-circuit count queries on the Query level, you should also think of using `IndexSearcher#count()` directly: E.g., this one returns `IndexReader#numDocs()` for `MatchAllDocsQuery` (thats a stupid simple case), but it can also return quick counts when there are no deleted docs in a segment and the statistics in index can answer the query. The changes here look fine (although I can't follow the discussion about those crazy flags true/false/whatever), but in addition to the code here, in case of no TopDocs and no facets, the code should call `IndexSearcher#count()`. In the facet case, it should at least use the `TotalHitCountCollector` as the final sink. -- 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...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org