Omnigraph
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

ExpressionModeWhere it appearsWhat it does
search(field, term)Full-textmatchFilters to nodes whose field matches the search term via an inverted index
fuzzy(field, term, distance)FuzzymatchFilters with edit-distance tolerance for typos and near-matches
match_text(field, phrase)PhrasematchFilters to nodes whose field contains the exact phrase
bm25(field, term)BM25 rankingorderRanks results by BM25 relevance score
nearest(field, vector)Vector KNNorderRanks results by cosine similarity to a query vector
rrf(nearest(...), bm25(...))HybridorderCombines two ranking signals with Reciprocal Rank Fusion

Where search expressions appear

Search expressions are used in two places inside a query:

  • match block -- search(), fuzzy(), and match_text() act as filters. They restrict which nodes are returned.
  • order clause -- bm25(), nearest(), and rrf() 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 typeSchema annotationIndex created
Full-text, fuzzy, phrase, BM25@index on a String fieldInverted index
Vector KNN@index on a Vector(N) fieldIVF-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.

On this page