如何对已经排序的结果进行排序。
要求说明:
{ “ customerAccountId”:“ cust123”, “ skuNumber”:222, “数量”:10, “ salesDate”:“ 2019-06-10T00:00:00Z”, }
For #1 I have grouped similar items and aggregate total quantities and sort -working.
SOLR QUERY:
customerAccountId:cust123&fl=skuNumber&omitHeader=true&wt=json
&json.facet={categories:{type:terms,field:skuNumber,limit:25,offset:0,sort:{quantity:desc},facet:{quantity:"sum(quantity)"}}}
For #2 if all quantities are same , i want them to order on salesdate -- NEED HELP
Example : suppose this is the data available
{
"customerAccountId": "cust123",
"skuNumber": 111,
"quantity": 1,
"salesDate": "2019-06-10T00:00:00Z",
},
{
"customerAccountId": "cust123",
"skuNumber": 111,
"quantity": 1,
"salesDate": "2019-06-09T00:00:00Z",
},
{
"customerAccountId": "cust123",
"skuNumber": 222,
"quantity": 10,
"salesDate": "2019-07-10T00:00:00Z",
},
{
"customerAccountId": "cust123",
"skuNumber": 222,
"quantity": 1,
"salesDate": "2019-07-10T00:00:00Z",
},
{
"customerAccountId": "cust123",
"skuNumber": 333,
"quantity": 2,
"salesDate": "2019-07-10T00:00:00Z",
},
**期望的响应应按顺序排列
sample Response:
"facets": {
"count": ,
"categories": {
"buckets": [
{
"val": "222",
"count": 2,
"quantity": 11
},
{
"val": "333",
"count": 1,
"quantity": 2
},
{
"val": "111",
"count": 2,
"quantity": 2
}