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 FilterThe 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 FiltersSubsequently, 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 FiltersInstead 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 ConnectionsSo 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 EdgesFilters on edges works the same way, just add the filter functions to your edge
#
Functions#
HasHas function: HasFn(predicate)
Dgraph Doc
#
TypeHas function: HasFn(predicate)
Dgraph Doc
#
BetweenBetween function: BetweenFn(predicate, from, to)
Dgraph Doc
#
UIDInUID function: UIDFn(predicate)
Dgraph Doc
#
UIDUID function: UID(predicate, vlaues)
Dgraph Doc
#
RegexpRegexp function: RegexpFn(predicate, pattern)
Dgraph Doc
#
EqEq function: EqFn(predicate, value)
Dgraph Doc
#
GeGe function: GeFn(predicate, value)
Dgraph Doc
#
GtGt function: GtFn(predicate, value)
Dgraph Doc
#
LeLe function: LeFn(predicate, value)
Dgraph Doc
#
LtLt function: LtFn(predicate, value)
Dgraph Doc
#
AlloftermsAllofterms function: AlloftermsFn(predicate, value)
Dgraph Doc
#
AnyoftermsAnyofterms function: Anyofterms(predicate, value)
Dgraph Doc
#
AlloftextAlloftext function: Alloftext(predicate, value)
Dgraph Doc
#
AnyoftextAnyoftext function: Anyoftext(predicate, value)
Dgraph Doc
#
MatchMatch function: Match(predicate, value)
Dgraph Doc
#
TermTerm function: Term(predicate, value)
Dgraph Doc
#
ExactExact function: Exact(predicate, value)
Dgraph Doc
#
FulltextFulltext function: Fulltext(predicate, value)
Dgraph Doc
#
ExprExpr function: Expr(predicate)
The Expr
allows you to write Raw statement as the value, the variable will not be escaped.