Search
Search
Full-text, fuzzy, vector, and hybrid search are first-class query expressions in Omnigraph.
Omnigraph has six built-in search modes. They are not separate services -- they are expressions you use directly inside .gq queries, alongside traversal, filtering, and projection.
The six search modes
| Expression | Mode | Where it appears | What it does |
|---|---|---|---|
search(field, term) | Full-text | match | Filters to nodes whose field matches the search term via an inverted index |
fuzzy(field, term, distance) | Fuzzy | match | Filters with edit-distance tolerance for typos and near-matches |
match_text(field, phrase) | Phrase | match | Filters to nodes whose field contains the exact phrase |
bm25(field, term) | BM25 ranking | order | Ranks results by BM25 relevance score |
nearest(field, vector) | Vector KNN | order | Ranks results by cosine similarity to a query vector |
rrf(nearest(...), bm25(...)) | Hybrid | order | Combines two ranking signals with Reciprocal Rank Fusion |
Where search expressions appear
Search expressions are used in two places inside a query:
matchblock --search(),fuzzy(), andmatch_text()act as filters. They restrict which nodes are returned.orderclause --bm25(),nearest(), andrrf()act as ranking functions. They sort results by relevance.
A query can combine both: filter in match, then rank in order.
query find_experts($term: String, $vec: Vector) {
match {
$p: Person
search($p.bio, $term)
}
order rrf(nearest($p.embedding, $vec), bm25($p.bio, $term))
return { $p.name, $p.bio }
}Index requirements
Search expressions require indexes on the fields they operate on:
| Search type | Schema annotation | Index created |
|---|---|---|
| Full-text, fuzzy, phrase, BM25 | @index on a String field | Inverted index |
| Vector KNN | @index on a Vector(N) field | IVF-HNSW index |
Without the right index, the query compiler rejects the query at compile time.
node Person {
name: String @key
bio: String @index # enables search(), fuzzy(), match_text(), bm25()
embedding: Vector(1536) @index # enables nearest()
}Combining search with traversal
Search expressions compose with the rest of the query language. You can filter by search, traverse edges, and project properties all in one query:
query experts_at_company($term: String, $company: String) {
match {
$p: Person
search($p.bio, $term)
$p worksAt $c: Company { name: $company }
}
order bm25($p.bio, $term)
return { $p.name, $c.name }
}Next steps
- Full-text Search -- keyword search, fuzzy matching, phrase search, and BM25 ranking.
- Vector Search -- nearest-neighbor search over embeddings.
- Hybrid Search -- combine BM25 and vector ranking with Reciprocal Rank Fusion.