[ 
https://issues.apache.org/jira/browse/SOLR-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14083954#comment-14083954
 ] 

Shai Erera commented on SOLR-6315:
----------------------------------

I thought about it, I think it's odd that whoever creates the NamedList 
instance needs to decide on the type based on how it's going to be serialized. 
Likewise for JSONResponseWriter to decide to write a NamedList as "map" style, 
if it's SimpleOrderedMap. In fact, I think it's somewhat broken: even if you 
pass {{json.nl=flat}}, most of the response would still be serialized as a map, 
because most of the code today creates a SimpleOrderedMap.

I think that in fact our default should have been "map". Yes, today it's 
"flat", but if you look at SolrTestCaseJ4 it assumes it's a "map", and that 
happens because of that hack around SimpleOrderedMap. Also, because so much 
code creates SimpleOrderedMap, the effective default is "map".

I don't know what do others feel about changing the default from "flat" to 
"map" (I personally think it's odd for a JSON writer to not use JSON style, 
that is map, by default), but I don't think we should keep SimpleOrderedMap in 
the code only because of response writing.

So would appreciate some guidance here -- we should fix this somehow. If we 
change the default to "map", I think it will let us remove SimpleOrderedMap, 
and fix the few places in the code which are badly written anyway as they rely 
on some default, yet not well defined (and some arcane), behavior. 
SolrTestCaseJ4 can easily be fixed to assume a Map and not List. But this 
changes back-compat, so I'm not sure -- should this be done for trunk only? I 
hope not, because it's a big change and would complicate future merges with 4x.

> Remove SimpleOrderedMap
> -----------------------
>
>                 Key: SOLR-6315
>                 URL: https://issues.apache.org/jira/browse/SOLR-6315
>             Project: Solr
>          Issue Type: Improvement
>          Components: clients - java
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>         Attachments: SOLR-6315.patch
>
>
> As I described on SOLR-912, SimpleOrderedMap is redundant and generally 
> useless class, with confusing jdocs. We should remove it. I'll attach a patch 
> shortly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to