Guide
Prefiltering ranks only the nodes or edges that a traversal reaches, instead of a whole
index. Use it when graph membership is a correctness boundary, such as “documents this
user may access” or “products reachable from this category.” It works the same way for
vector and full-text search.
How it works
Every prefiltered search runs in the same order: graph traversal → exact candidate membership → ranking → top k.- The traversal is authoritative. A result outside the candidate set is never returned, even when approximate index structures accelerate ranking.
- Output IDs are a deduplicated subset of the input IDs.
- Each selected row keeps its bindings, path, and sack, with
$distance(vector) or$score(text) attached. - Empty input returns without opening the index.
- A tenant-partitioned index requires the same tenant value used to build the candidate stream.
Vector prefiltering
This request finds the projects a user owns, ranks that exact set by embedding distance, and returns the top five. It requires an active three-dimensional cosine vector index onProject.embedding.
Full-text search prefiltering
This request finds the documents a user can read, ranks that exact set for"graph databases", and returns the top five. It requires an active
text index on Document.body.
SDK methods
Rust, TypeScript, and Python pick the node or edge wire operation from the current stream. Go has separate node and edge methods.Result limits
Checklist
- Create a compatible index for the candidate label and property. Vector queries must match the index dimension exactly.
- Pass the same tenant value as the index when it is tenant-partitioned.
- Project
$distanceor$scorebefore traversing away from a ranked hit. - Bound the candidate traversal when its size can grow without application limits.
Next steps
Vector indexes
Create the dimensioned index used for ranking.
Text indexes
Create the BM25 index used for full-text ranking.
Traversals
Build the candidate set by following relationships.
Project search results
Preserve ranked hit metadata before continuing a traversal.