Cascade only on filters

Is it possible for @cascade to operate only on filters? For example, if I have a query like the one below, I want to get all of the nodes where edge1 and edge2 meet the filter even if field1 and field2 are not present.

{
  node(func: eq(dgraph.type, "Type1")) @cascade {
    field1
    field2
    edge1 @filter(anyofterms(field3, "value1"))
    edge2 @filter(anyofterms(field4, "value2"))
  }
}

I know I can drop field1 and field2 from the query and get the uids instead, but then I have to do multiple queries to get the nodes. I was hoping to do a single query.

Parameterized cascade was added to master, but I don’t know if it is deployed to Slash GraphQL yet, or if you’re even using Slash GraphQL.

You can just pass in the predicates like: @cascade(edge1, edge2)

P.S. Checkout the merged PR comment at the end of: Parameterized Cascade topic

1 Like

Thank you. It looks like it has not made it into any of the current releases yet, or I’m not searching properly. I’ll keep an eye out and upgrade when it is available.

@abhijit-kar by his query, I don’t think he is using GraphQL/Slash.

@asg I don’t have the answer from the top of my mind. But I’m 100% about adding at least a nested block with uid works. I would use it to relieve the conscience.

e.g

edge1 @filter(anyofterms(field3, "value1")) { uid }
edge2 @filter(anyofterms(field4, "value2")) { uid }

Just that.

Cheers.