:   - keys can't be repeated in a NamedList:
:    In XML you could have <lst><int name="foo">5</int><int
: name="foo">10</int></lst>
:    This will be writen out in JSON as {"foo":5, "foo 1":10}.
:   - Order won't be maintained in a NamedList.  Solr will maintain
: order when serializing to JSON, but most client sides will ignore that
: ordering (only arrays are ordered).  This isn't a problem for normal
: result sets, but could be a problem for custom data for faceted
: browsing for instance.

I'm confused ... it's always been very clear to me that a NamedList is
first and formost a "List" with ordering.  it just so happens that it
allows for elements to be anotate with a name, and that items can be
looked up by their name (if they have one, and if they are the only
element in that list with that name).

When it came to the XML representation, we used <lst> to denote a List of
items, and allowed those items to be named so it could also be used for
NamedLists .. from there it was easy to reuse <lst> for Maps with the
assumption that the client's could either "know" when it was ok to
parse the data into a Map, or it could play it safe and assume it needed
to model it as a List.

With the introduction of a JsonResponseWriter it seems to me that:

1) there is no reason why a JsonResponseWriter needs to treat
List/NamedList/Maps identically the way XmlResponseWriter does.
2) we should try to ensure that trivial parsing of the format of a
NamedList should preserve the order -- if we have to "lose information" in
the convertion, i would rather throw away the "name" for each item (and
treat the list as a JSON "array"

Yonik: I'm curious how your current implementation deals with NamedLists
where no element has a name? .. or where some elements have no names, and
at least one element has "" as it's name?

Why not output NamedLists a JSON object?

Also, should we be at all concerned with the possibility that clients
might confuse a NamedList containing some names/values with a Document
containing fields/values ... should there be an "object type" member in
every object the JsonResponseWriter outputs?

: Other potential issues:  would it be useful to be able to change the
: serialized format so that something like Ruby could do a direct eval()
: like JavaScript can?  Might also want to have an option to use python
: unicode strings also ( u'my unicode string' )

those would be differnet ResponseWriters wouldn't they?



-Hoss

Reply via email to