These operations allow you to search for vectors in Helix. Searching is done using cosine similarity.

SearchV

Search for vectors in your graph.

SearchV<Type>(vector, {properties})

Example:

In schema.hx:

V::Document {
    text: String
    created_at: I64
}

In query.hx:

QUERY SearchVector (vector: [F64], k: I64) =>
    // Search for the vector in the graph (returns k results)
    documents <- SearchV<Document>(vector, k)
    RETURN documents

Note: Currently, we only support using an array of F64 values to represent the vector. We will be adding support for different types such as F32, binary vectors and more in the very near future. Please reach out to us if you need a different vector type.


Postfiltering

You can postfilter the results of a search by adding a WHERE clause to the query. The condition in the WHERE step must evaluate to a boolean value.

SearchV<Type>(vector)::WHERE(<boolean_expression>)

Example:

QUERY SearchVector (vector: [F64], now: I64) =>
    documents <- SearchV<Document>(vector)
    documents <- documents::WHERE(_::{created_at}::LTE(now))
    RETURN documents

The condition is applied after the search has been completed.