Sorting by document values in couchbase and scala

Hi all,
The documents of type Product that I store on my bucket looks like:
{
“id”: “5fe281c3-81b6-4eb5-96a1-331ff3b37c2c”,
“defaultName”: “default name”,
“defaultDescription”: “default description”,
“references”: {
“configuratorId”: “1”,
“seekId”: “1”,
“hsId”: “1”,
“fpId”: “1”
},
“tenantProducts”: {
“2”: {
“adminRank”: 1,
“systemRank”: 15,
“categories”: [
“3”
]
}
},
“docType”: “product”
}

I want to get all products that belong to certain tenant and category.
so i made this view:
function (doc, meta) {
if(doc.docType == “product”)
{
for (var tenant in doc.tenantProducts) {
var categories = doc.tenantProducts[tenant].categories
// emit(categories, doc);

for(i=0;i<categories.length;i++)
{
     emit([tenant, categories[i]], doc);
}   

}
}
}

Using keys like:
[[“tenantId”, “Category1”]] //Can also have: [[“tenant1”, “Category1”],[“tenant1”, “Category2”] ]

Will give me the required result.

Now the question is, how can i sort the answer by adminRank and systemRank ?
(adminRank is a field inside my value of the view…)

I understand i can only sort by key in couchbase, so maybe i should change my key to be:
[[“tenantId”, “Category1”, “systemRank”, “adminRank”]]

But then when i build the key, i must put something as systemrank, and i cant put *…

Any ideas?