nick-boss-tech opened a new pull request, #5138: URL: https://github.com/apache/solr/pull/5138
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-7520 ## What happens today **A grouped distributed search never completes its post filter on the shards.** The Jira report describes a query with an `fq` post filter, several shards, and grouping. The post filter's results are missing from the response. In `CommandHandler.searchWithTimeLimiter` at base commit `14c7aac0d15`, the post filter is set as the collector (lines 254-257), the search runs, and nothing calls `complete()` on the filter afterwards. The non-grouped path in `SolrIndexSearcher` does call `complete()`. The ticket names the method `finish`; the current name is `complete()`. ## What this change does **The grouped path now calls `complete()` on the post filter after each shard search, as the non-grouped path does.** The search in [CommandHandler.java](https://github.com/nick-boss-tech/solr/blob/10b6931e1c058d76392c4ba6d53b45bee251e3d2/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java#L259-L268) runs inside a `try`, and its `finally` calls `complete()` when a post filter is set. The change touches only the shard side. The coordinator code is not changed. ## Proof **The new assertion fails on the base code and passes with this change.** [AnalyticsMergeStrategyTest](https://github.com/nick-boss-tech/solr/blob/10b6931e1c058d76392c4ba6d53b45bee251e3d2/solr/core/src/test/org/apache/solr/search/AnalyticsMergeStrategyTest.java#L93-L106) gets one new assertion. It sends the first phase grouped request to one shard and asserts that the `analytics` section is present. On base code `14c7aac0d15`, with this test, the assertion fails with "analytics section missing for grouped shard query". With this change, at head `10b6931e1c058d76392c4ba6d53b45bee251e3d2`, verified 2026-10-05: AnalyticsMergeStrategyTest 1 of 1, AnalyticsQueryTest 1 of 1, TestGroupingSearch 17 of 17, TestDistributedGrouping 2 of 2. All pass. ## Limits **This change leaves the coordinator as it is, and the new test checks one shard only.** - Merge strategies still do not run for grouped responses at the coordinator. This change does not touch that. If you want it, I can open a follow-up ticket and PR for it. - The new assertion checks one shard directly. It does not check a full grouped response through the coordinator. Changelog: [changelog/unreleased/SOLR-7520-grouping-postfilter-complete.yml](https://github.com/nick-boss-tech/solr/blob/10b6931e1c058d76392c4ba6d53b45bee251e3d2/changelog/unreleased/SOLR-7520-grouping-postfilter-complete.yml) ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
