Guide
HelixDB filters in two places:
- A source predicate such as
nWithLabelWhere/n_with_label_whereselects the initial candidates. Scoped to a label, it can read a secondary index, so filter here whenever you can. .where(...)filters the current stream at any later point in a traversal, for example after following an edge.
SourcePredicate is an alias of Predicate in every
SDK, and Go’s Source… constructors build the same values as its Pred… constructors.
For search candidate sets, see Filter search candidates; to
sort and page, see Ordering and pagination.
Predicates
- Comparisons take a literal or a typed parameter expression.
startsWith,endsWith, andcontainstake literal strings only. For a parameter substring, usecontainsParam(PredContainsExprin Go).isIntakes a literal list. For a list parameter, useisInParam, or pass the parameter toPredIsInin Go.comparetakes an expression on each side, so it can compare two properties:compare(Expr.prop("spent"), CompareOp.Gt, Expr.prop("budget")).
Filter a stream
Null, missing, and type rules
A missing property reads asnull:
neqagainst a non-null value matches a missing property:neq("status", "archived")also returns nodes without astatus. AddisNotNull("status")to exclude them.notmatches a missing property only when the inner predicate does not:not(gt("age", 30))matches it,not(isNull("age"))does not.- Comparisons across types are false (a string never equals or orders against a number;
a date-time never equals a string), so
neqacross types is true. i64,f64, andf32compare by exact numeric value:5equals5.0, butf320.1does not equalf640.1, because a storedf32keeps its widened value.betweenincludes both bounds and is false when the minimum exceeds the maximum.startsWith,endsWith, andcontainsare case-sensitive and match strings only.containsis a substring test, not array membership.isIncompares each list element with the same rules aseq.
Filter steps
These steps are shorthand for common predicates:withinandwithoutmatch by kind and ID, so a node never matches an edge.- On a node stream,
edgeHastests the node, not the edge that reached it. To filter by an edge property, step onto the edges and back:outE("FOLLOWS").where(Predicate.gte("since", "2026-01-01")).outN().
Filter search candidates
To restrict vector or full-text search to a candidate set, build the traversal that decides membership and search within it. Do not filter search results afterward with.where(...): excluded high-ranking hits still consume the top k. See
Prefiltered search.
Vector prefiltering
See Vector prefiltering.Full-text search prefiltering
See Full-text search prefiltering.Next steps
Ordering and pagination
Sort the filtered stream and return it one page at a time.
Typed parameters
Move request-specific filter values out of the AST.
Secondary indexes
Back equality and range predicates with an index.
Prefiltered search
Rank only the records a traversal reaches.