The issue is that fields are held in HashMaps internally so field order is not maintained. The thinking behind this was that field order was not so important as Tuples are mainly accessed by keys. But I think it's worth looking into an approach for maintaining field order. Feel free to create jira about this issue and update this thread with the issue number.
Joel Bernstein http://joelsolr.blogspot.com/ On Wed, Jan 25, 2017 at 9:59 AM, Zheng Lin Edwin Yeo <edwinye...@gmail.com> wrote: > Hi, > > I'm trying out the Streaming Expressions in Solr 6.3.0. > > Currently, I'm facing the issue of not being able to get the fields in the > result-set to be displayed in the same order as what I put in the query. > > For example, when I execute this query: > > http://localhost:8983/solr/collection1/stream?expr=facet(collection1, > q="*:*", > buckets="id,cost,quantity", > bucketSorts="cost desc", > bucketSizeLimit=100, > sum(cost), > sum(quantity), > min(cost), > min(quantity), > max(cost), > max(quantity), > avg(cost), > avg(quantity), > count(*))&indent=true > > > I get the following in the result-set. > > { > "result-set":{"docs":[ > { > "min(quantity)":12.21, > "avg(quantity)":12.21, > "sum(cost)":256.33, > "max(cost)":256.33, > "count(*)":1, > "min(cost)":256.33, > "cost":256.33, > "avg(cost)":256.33, > "quantity":12.21, > "id":"000001", > "sum(quantity)":12.21, > "max(quantity)":12.21}, > { > "EOF":true, > "RESPONSE_TIME":359}]}} > > > The fields are displayed randomly all over the place, instead of the order > sum, min, max, avg as in the query. Is there any way which I can do to the > fields in the result-set to be displayed in the same order as the query? > > > Regards, > Edwin >