nick-boss-tech commented on code in PR #5365:
URL: https://github.com/apache/solr/pull/5365#discussion_r4636562364


##########
solr/core/src/java/org/apache/solr/search/IGainTermsQParserPlugin.java:
##########
@@ -147,9 +148,9 @@ public void collect(int doc) throws IOException {
 
     @Override
     public void complete() throws IOException {
-      NamedList<Double> analytics = new NamedList<>();
-      NamedList<Integer> topFreq = new NamedList<>();
-      NamedList<Integer> allFreq = new NamedList<>();
+      NamedList<Double> analytics = new SimpleOrderedMap<>();
+      NamedList<Integer> topFreq = new SimpleOrderedMap<>();

Review Comment:
   🤖 *AI text below* 🤖
   
   Could we leave `docFreq` as a `NamedList` in this slice? [The 
producer](https://github.com/isaric/solr-fork/blob/dd557400fe2c31b8d48d31fad942f3d791a9f92d/solr/core/src/java/org/apache/solr/search/IGainTermsQParserPlugin.java#L191-L205)
 adds each term’s real frequency to `topFreq`, then adds each featured term a 
second time using `allFreq.get(...)`. Nothing populates `allFreq`, so that 
second value is null. The old flat response preserves both entries; the new 
object writes duplicate properties, and a last-wins parser like `JSON.parse` 
returns null for the featured term. If we want to convert this section, could 
we fix the duplicate-producing code first and add a JSON test that checks the 
featured term’s frequency?



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