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


##########
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:
   🤖 *AI text below* 🤖
   
   Could we remove this bullet from the JSON migration list? The built-in 
managed word-set and synonym GET handlers already return `initArgs` through 
`buildMapToStore()`, which converts it to a map on the base branch too. The 
Java type changes here, but clients of those endpoints already receive a JSON 
object. The same correction applies to the changelog.



##########
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:
   🤖 *AI text below* 🤖
   
   If the Schema Browser keeps accepting object-form `topTerms`, could we sort 
the entries by descending count before grouping them? JavaScript enumerates 
integer-like keys first, even when Luke emitted them in frequency order. 
Running this helper in Node with `{"alpha":50,"21":30,"omega":30,"4":10}` gave 
count groups `10, 30, 50, 30`; the equivalent flat response gave `50, 30, 10`, 
with both 30-count terms together. A mixed numeric/text fixture would cover 
this.



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