Filters
In this section we'll learn how to filter the root query and its nested edges.
You'll also find all the available definitions of dqlx functions
Root Filter#
The first constraint we need to provide to our query is a single filter to help Dgraph minimise the amount of data we want to query against.
We can achieve data using any functions in dqlx that ends in Fn
Query Filters#
Subsequently, we can apply other filters to our query, in order to narrow down the exact data we are after.
We do that using the Filter() function
You can either add filters within a single Filter() call, or chain multiple Filter calls, the result is the same.
All the above filters will be concatenated together with an AND condition
Sugars on Filters#
Instead of using the Fn functions within our Filter we can use the equivalent of that function as a Map.
This makes it more elegant to express the same filter type for different fields
Filtering Connections#
So far the filters we've seen till now are always concatenated with an AND condition.
In order to conjunct the filters together with different conditions such as OR we do the following.
which will translate in:
Filtering Edges#
Filters on edges works the same way, just add the filter functions to your edge
Functions#
Has#
Has function: HasFn(predicate)
Dgraph Doc
Type#
Has function: HasFn(predicate)
Dgraph Doc
Between#
Between function: BetweenFn(predicate, from, to)
Dgraph Doc
UIDIn#
UID function: UIDFn(predicate)
Dgraph Doc
UID#
UID function: UID(predicate, vlaues)
Dgraph Doc
Regexp#
Regexp function: RegexpFn(predicate, pattern)
Dgraph Doc
Eq#
Eq function: EqFn(predicate, value)
Dgraph Doc
Ge#
Ge function: GeFn(predicate, value)
Dgraph Doc
Gt#
Gt function: GtFn(predicate, value)
Dgraph Doc
Le#
Le function: LeFn(predicate, value)
Dgraph Doc
Lt#
Lt function: LtFn(predicate, value)
Dgraph Doc
Allofterms#
Allofterms function: AlloftermsFn(predicate, value)
Dgraph Doc
Anyofterms#
Anyofterms function: Anyofterms(predicate, value)
Dgraph Doc
Alloftext#
Alloftext function: Alloftext(predicate, value)
Dgraph Doc
Anyoftext#
Anyoftext function: Anyoftext(predicate, value)
Dgraph Doc
Match#
Match function: Match(predicate, value)
Dgraph Doc
Term#
Term function: Term(predicate, value)
Dgraph Doc
Exact#
Exact function: Exact(predicate, value)
Dgraph Doc
Fulltext#
Fulltext function: Fulltext(predicate, value)
Dgraph Doc
Expr#
Expr function: Expr(predicate)
The Expr allows you to write Raw statement as the value, the variable will not be escaped.