[
https://issues.apache.org/jira/browse/SOLR-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14084111#comment-14084111
]
Shai Erera commented on SOLR-6315:
----------------------------------
Thanks Yonik for explaining this. I realized as I started to debug test
failures that SimpleOrderedMap is sort of a marker interface. What bothered me
in the javadocs are the things that I noted above (the conflicting statements
about when to use this class, its name in relation to Jack's comment). Maybe
this could be named MapNamedList or something, without mentioning order or
access by key and efficiency. And a comment about how this class is a marker
interface for response writers to output its content as a map ...
I also wish that JSONResponseWriter would decouple itself from a particular
type of NamedList. It feels like a hack to me, and I don't mean that
negatively. For example, a better 'hack' IMO is if we added to NamedList a
preferedOutputStyle member, which could be {{null}} for all NLs other than
MapNamedList. Maybe we won't even need that specific class, we could add a ctor
argument .. there are options. And then JSONResponseWriter could check the
preferedOutputStyle as an override to the default style it received ... maybe
then it would make sense to me, I don't know.
As a user of the API, maybe even Solr's REST API, it's not clear to me how
should I refer to "json.nl". It seems that when I set it, I determine the
output of _some_ elements in the response JSON, but not all of them. It's as if
I need to set the style, run some queries, note the elements that do not
correspond to the style that I asked for, and rely on that output's style?
bq. one would want it serialized as something that would preserve order
What do you mean by "preserve order"? The order of all values of a single key,
or order between both keys and values? An example, if I make these series of
sets: {{set("k1", "v1"); set("k2","v3"); set("k1", "v2");}}, which of the
following outputs do you refer to as preserving order:
{noformat}
{
"k1": [ "v1", "v2" ],
"k2" : "v3"
}
{noformat}
OR
{noformat}
[ "k1", "v1", "k2", "v3", "k1", "v2" ]
{noformat}
I realize the second one adheres to any order preservation, but I don't
understand if that's the intention, or the former format is considered as
preserving order too.
What's your recommendation then for this issue? I feel like there are some
things we can do to improve the code here. Maybe there are minor like a class
rename, javadocs clarification and that's it. Maybe they are slightly broader,
e.g. the preferedOutputStyle parameter to NamedList.
What's also your opinion about JSONResponseWriter ignoring the "json.nl"
parameter for SimpledOrderedMap? Is this OK, API-wise?
> 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: [email protected]
For additional commands, e-mail: [email protected]