isaric opened a new pull request, #5392:
URL: https://github.com/apache/solr/pull/5392

   https://issues.apache.org/jira/browse/SOLR-18677
   
   # Description
   
   `IGainTermsQParserPlugin` built its `docFreq` section in two passes: every 
term's document frequency first, then each featured term again with 
`allFreq.get(term)`, where `allFreq` was created but never populated. So every 
featured term appeared twice, the second time with a null value. The flat 
`json.nl` rendering showed both entries; `json.nl=map`, or any last-wins JSON 
parser, read the featured term's frequency as null.
   
   Found while reviewing #5365, where `docFreq` is kept as a `NamedList` 
because of this.
   
   # Solution
   
   Delete the second pass and the unused map; the first pass already records 
every term, featured ones included. Two lines removed, no other behavior change.
   
   AI disclosure: the test, the fix and this description were drafted with 
Claude Code and reviewed by me.
   
   # Tests
   
   New `IGainTermsQParserPluginTest` (the parser had no functional test in 
solr/core; it is exercised through the streaming `features` expression). It 
indexes six documents with an outcome field, runs `{!igain}` as a filter query, 
and asserts that `docFreq` has one non-null entry per term and the expected 
value for each featured term. Written first, it fails on `main` with "docFreq 
repeats yellow" and passes with the fix. `QueryEqualityTest` and the streaming 
`features` tests pass, as does `./gradlew check -x test`.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) 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.
   - [x] I have given Solr 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, not available for 
branches on forks living under an organisation)
   - [x] I have developed this patch against the `main` branch.
   - [x] I have run `./gradlew check`.
   - [x] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   - [x] I have added a [changelog 
entry](https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc) for my 
change
   


-- 
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]

Reply via email to