On 1/22/07, Chris Hostetter <[EMAIL PROTECTED]> wrote:
For the record, I predicted this problem would come up... http://www.nabble.com/JSON-output-support-tf1915406.html#a5247622 : We could introduce some new types to tell the output handlers just how : important it is to maintain order, so all named lists don't get : treated the same. : : Example: : class OrderedNamedList extends NamedList {...} Ugh ... please no ... the "List" in "NamedList" is what indicates that order is a factor (it's what distinguishes a NamedList from a hypothetical MultiValueMap")
But we also use it when order doesn't totally matter, but it's still nice.
: Using OrderedNamedList, means that it's really important that order be : maintained, and we could a different strategy such as interleaving : keys and values in a single array (or another strategy set by : json.orderednl?) i would much rather see us change any places in the Solr request handlers where order does *not* matter to just use a Map ...then the ResponseWriter could know that order in Maps doesn't matter, but order in NamedLists do.
The problem is that it's not clear cut. Should the top level (containing responseHeader, result, facets, etc) be ordered or unordered? We currently order pretty much everything, even when it's slightly redundant (we highlight docs in order, but we also include a unique id). Even when order doesn't strictly matter, it's still nice to see things ordered in the response (the responseHeader first for instance). So what's your proposal for what a facet list should look like in JSON? -Yonik