My query:
{
var(func: type(preference)){
~has @filter(eq(uuid,"2bac1666-f363-4a56-ac25-666345ceaasrael"))
{
has {
mem_preference_uids as uid
}
}
}
var(func: type(deal)){
matches: prefers
@filter(uid(mem_preference_uids)) {
~prefers {
name
deal_uids as uid
}
}
}
Question: How to return like this: ordersort by count(deal.matches) ?
q(func: type(deal),first:5) @filter(uid(deal_uids)) {
uid
uuid
name
matches: count(prefers)@filter(uid(mem_preference_uids))
}
}
I wanted to return results sorted by descending number of matches. How do I do this?
{
"data": {
"q": [
{
"uid": "0x1a1",
"uuid": "6cfbd9f1-5fdc-4ca9-a130-d2ab325ddd",
"name": "sayulaughteru",
"matches": 2
},
{
"uid": "0x1a3",
"uuid": "6cfbd9f1-5fdc-4ca9-a130-d2ab325ddf",
"name": "maude",
"matches": 1
},
{
"uid": "0x1ab",
"uuid": "6cfbd9f1-5fdc-4ca9-a130-d2ab325ddmg",
"name": "morag",
"matches": 1
},
{
"uid": "0x1ad",
"uuid": "6cfbd9f1-5fdc-4ca9-a130-d2ab325ddmln",
"name": "lindeal",
"matches": 3
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 93500,
"processing_ns": 1533200,
"encoding_ns": 24100,
"assign_timestamp_ns": 648000,
"total_ns": 2415200
},
"txn": {
"start_ts": 8923
},
"metrics": {
"num_uids": {
"": 23,
"_total": 71,
"dgraph.type": 0,
"has": 1,
"name": 8,
"prefers": 9,
"uid": 11,
"uuid": 5,
"~has": 11,
"~prefers": 3
}
}
}
}