isaric commented on code in PR #5365:
URL: https://github.com/apache/solr/pull/5365#discussion_r4642492898


##########
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:
   Good catch, and a pre-existing bug: allFreq is never filled, so every 
featured term gets a second, null entry. Left docFreq as a NamedList in this 
slice (1d3c635); the duplicate entries deserve their own JIRA.



##########
solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java:
##########
@@ -1276,7 +1276,7 @@ public NamedList<Integer> toNamedList(IndexSchema schema) 
{
         aslist.add(0, pop());
       }
 
-      NamedList<Integer> list = new NamedList<>();
+      NamedList<Integer> list = new SimpleOrderedMap<>();

Review Comment:
   Agreed; indexedToReadable() isn't injective for Trie precision terms. 
topTerms stays a NamedList, histogram moves (1d3c635).



##########
solr/webapp/web/js/angular/controllers/schema.js:
##########
@@ -707,30 +707,50 @@ var getTermInfo = function(data) {
     if (data && data.topTerms) {
         termInfo.topTerms = [];
 
-        var currentGroup = {count: 0}
-        for (var i = 0; i < data.topTerms.length; i += 2) {
-            var count = data.topTerms[i + 1];
+        var currentGroup = {count: 0};
+        var topTerms = namedListEntries(data.topTerms);

Review Comment:
   Reproduced with your fixture. Added a stable sort by descending count before 
grouping; both forms now give 50:alpha, 30:21+omega, 10:4 (1d3c635).



##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########
@@ -62,3 +62,24 @@ Plugins that use them, for example custom request handlers 
or update processors,
 SolrJ clients write request content with `RequestWriter.ContentWriter` instead.
 
 The unused `ContentStreamBase.create(RequestWriter, SolrRequest)` and 
`ContentStreamBase.setSize(Long)` methods have been removed.
+
+== Response Format
+
+=== Some response sections are JSON objects regardless of json.nl
+
+Solr builds many response sections as a `NamedList`, which the JSON response 
writer renders according to the `json.nl` parameter (by default as a flat array 
of alternating names and values).
+Sections whose names never repeat are now built as a `SimpleOrderedMap` 
instead, which the JSON writer always renders as a JSON object, exactly as 
`json.nl=map` did before.
+Clients that read these sections with the default `json.nl=flat` (or with 
`arrarr` / `arrmap`) must now read a JSON object; clients using `json.nl=map` 
or XML see the same response shape.
+SolrJ's javabin decoder now returns `SimpleOrderedMap` instances for these 
sections instead of plain `NamedList` instances.
+Existing casts to `NamedList` remain valid, but code that depends on the 
concrete type or map behavior must account for the change.
+The affected sections are:
+
+* Core Admin `SPLIT`: the `response` section (`timing`, `failed`) is an object.
+* Luke request handler: a field's `histogram` and `topTerms` are objects. The 
Admin UI's Schema Browser reads both forms.
+* MoreLikeThis handler: `interestingTerms` with `mlt.interestingTerms=details` 
is an object keyed by term.
+* MoreLikeThis component in SolrCloud: `moreLikeThis` is an object keyed by 
document, as it already was on a single node.
+* Managed resources (`/schema/analysis/...`): `initArgs` is an object.

Review Comment:
   Right, buildMapToStore already converts it. Dropped the bullet and the 
changelog mention; the Java change stays (1d3c635).



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