[
https://issues.apache.org/jira/browse/SOLR-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14084374#comment-14084374
]
Shai Erera commented on SOLR-6315:
----------------------------------
OK, so I think if the jdocs said exactly (and only) what you wrote above, that
would be fine. It will definitely remove the confusion around this class, as as
you state it -- it's only used for JSON formatting. I would even call it a
MapNamedList or JSONMapNamedList, to make it more clear.
I still don't like it that whoever creates a NamedList has any saying about, or
need to be aware of, how it will be output eventually. I don't understand why
the different RequestHandlers decide to create a SimpleOrderedMap and not a
NamedList -- why do they care how the Java class will be written as a response?
It should be the job of the response writer, and then e.g. users who care about
different output formats should worry about it, not the developer who codes the
RequestHandler.
So maybe if we decoupled NamedList and SimpleOrderedMap, into two separate
implementations (same interface though), such that the RequestHandler's
decision was more intelligent and intentional: SimpleOrderedMap would use a
Map<String,Object> internally, forbid the use of a null key, or multi-valued
keys and NamedList would allow anything.
Then, whoever initializes it must decide in advance if it's going to need null
or multi-valued keys and if it doesn't, it uses the simple implementation.
Otherwise it uses the more generic NamedList. And JSONResponseWriter deciding
to write a SimpleOrderedMap as a JSON "map" would make sense. And default to
"flat" for NamedList would also make sense, since by definition it allows null
keys, multi-valued keys etc.
Is that something you think we could explore? Do you think that if I did that,
existing handlers would break (because today SimpleOrderedMap does not limit
you like that)? I don't mind doing this work, but would like to get your
feedback first.
> 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]