kesor commented :
When a @recurse query stops because of loop:false, it DOES return the facets but DOES NOT return the predicate that is associated with these facets.
Example:
{
set {
_:a <name> "A" .
_:a <dgraph.type> "Example" .
_:b <name> "B" .
_:b <dgraph.type> "Example" .
_:a <connects> _:b (number=1) .
_:b <connects> _:a (number=7) .
}
}
query {
example(func:type("Example"))
@recurse {
name
connects @facets
}
}
Notice how example[0].connects[0] is missing connects[] but has the facets for that predicate!
{
"data": {
"example": [
{
"name": "A",
"connects": [
{
"name": "B",
"connects|number": {
"0": 7
}
}
],
"connects|number": {
"0": 1
}
}
On the other hand, when loop:true is enabled (with depth) it appears that the bug is not there.
query {
example(func:type("Example"))
@recurse(loop:true,depth:4) {
name
connects @facets
}
}
{
"data": {
"example": [
{
"name": "A",
"connects": [
{
"name": "B",
"connects": [
{
"name": "A",
"connects": [
{
"name": "B"
}
],
"connects|number": {
"0": 1
}
}
],
"connects|number": {
"0": 7
}
}
],
"connects|number": {
"0": 1
}
},