because of th enature of the CSV format, the order of the fields *has* to be deterministic and consistent for all documents, so the response writer sorts them into the approrpaite columns.
for JSON & XML formats this consistency isn't required, so instead Solr writes out hte fields of each document in the order they were found in the index because it's the fastest & most efficient for solr to return the data -- no extra sorting required. Many decisions about what features live in solr follow the principle of "what can we do more efficiently then the client" ... simple things like result set sorting & pagination, faceting & highlighting are much more efficient to do server side using the underlying lucene index then if solrjust shipped all the data across the wire and left it up to the client, but something like "make the order of fields consistent for each doc in the response" is just as fast/efficient for the client to do as if it was done on the server side. (which is not to say that such a feature would not be possible to implement server side, or that any one would have a phiolosophical objection to commiting a patch that added an option like this ... i'm just trying to explain why something like this has never been a priority) : Date: Tue, 28 Apr 2015 17:06:02 +0200 : From: Raphaël Tournoy <raphael.tour...@ccsd.cnrs.fr> : Reply-To: solr-user@lucene.apache.org : To: solr-user@lucene.apache.org : Subject: Choosing order of fields in response with fl=field_1, field_2 : : Hi Everyone, : : if add fl=field_1, field_2 in a query the order of fields in the response is : good for my needs : : : { : field_1 : value X, : field_2 : value Y : } : : *however* it works only with the CSV reponse format :-( : : How do i get the same functionnality with for instance XML and JSON reponse : format ? : : with wt=json or wt=xml i get fields in the order they are indexed : : Why does it only work with CSV response format ? : : : thank you, : : -- : Raphaël : : -Hoss http://www.lucidworks.com/