Skip to main content
Guide
HelixDB filters in two places:
  • A source predicate such as nWithLabelWhere / n_with_label_where selects 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.
Both take the same predicates: 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, and contains take literal strings only. For a parameter substring, use containsParam (PredContainsExpr in Go).
  • isIn takes a literal list. For a list parameter, use isInParam, or pass the parameter to PredIsIn in Go.
  • compare takes 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 as null:
  • neq against a non-null value matches a missing property: neq("status", "archived") also returns nodes without a status. Add isNotNull("status") to exclude them.
  • not matches 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 neq across types is true.
  • i64, f64, and f32 compare by exact numeric value: 5 equals 5.0, but f32 0.1 does not equal f64 0.1, because a stored f32 keeps its widened value.
  • between includes both bounds and is false when the minimum exceeds the maximum.
  • startsWith, endsWith, and contains are case-sensitive and match strings only. contains is a substring test, not array membership.
  • isIn compares each list element with the same rules as eq.

Filter steps

These steps are shorthand for common predicates:
  • within and without match by kind and ID, so a node never matches an edge.
  • On a node stream, edgeHas tests 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.