I don’t think it is possible, unless I got it wrong.
Putting normalize on the root query you can “flat” it and repeat the value on both objects. This would be the most similar to what I got.
query main($text: string = "health"){
q(func: anyofterms(term, $text), first: 2) @filter(eq(dgraph.type, "Term")) @normalize {
term: term
~has_term @facets (a as appears) {
title
has_category {
category : category
}
}
appears : sum(val(a))
}
}
{
"data": {
"q": [
{
"appears": 5,
"category": "Health",
"term": "health",
"~has_term|appears": 3
},
{
"appears": 5,
"category": "Health",
"term": "health",
"~has_term|appears": 2
}
]
}
}