vectorSearch
Search RushDB records by vector similarity on an indexed property, using a text query or precomputed vector, with optional filters to narrow and rank results.
Instructions
Perform direct vector similarity search over records whose propertyName has been indexed with createEmbeddingIndex. For managed indexes: provide a free-text query — RushDB embeds it and returns the most similar records ranked by similarity (__score). For external indexes: provide a queryVector (pre-computed number[]) instead of query text. A where filter narrows candidates before ranking. Requires an embedding index in "ready" status for the given label+propertyName.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ef | No | ANN gather breadth when the search runs on the ANN graph. | |
| mode | No | How to rank candidates. "auto" (default): exact on small indexes, the ANN graph on large ones. "exact"/"ann" force a path ("ann" needs a cosine index). | |
| rrfK | No | Hybrid only: the RRF smoothing constant (default 60). | |
| skip | No | Number of results to skip for pagination (default 0). | |
| text | No | Adds a keyword (BM25) leg, making it a hybrid search: both rankings run over the same filtered records and are fused. `query` defaults to the semantic query; `index` defaults to the one ready text index of the first label (see listTextIndexes). | |
| index | No | Name of the embedding index to search (as listed by findEmbeddingIndexes or getSchema). When given, propertyName and labels default to the index's own. | |
| limit | No | Maximum number of results to return (default 10). | |
| query | No | Free-text query to embed and compare against stored vectors (managed indexes only). Mutually exclusive with queryVector. | |
| where | No | Optional filter applied before scoring (activates prefilter mode). | |
| fusion | No | Hybrid only: "rrf" (default) fuses ranks; "dbsf" fuses each leg's scores normalized by its own distribution. | |
| labels | No | One or more record labels to scope the search. The first label is used to resolve the embedding index. | |
| weight | No | Hybrid only (with `text`): the vector leg's share of the fused score, ≥ 0 (default 1). | |
| dimensions | No | Disambiguates when multiple indexes share the same label+property. Inferred from queryVector length when queryVector is supplied. | |
| sourceType | No | Select which index type to search. Required when both managed and external indexes exist for the same label+property. | |
| queryVector | No | Pre-computed embedding vector to search with (external indexes). Mutually exclusive with query. Length must match index dimensions. | |
| propertyName | No | Name of the indexed property to search against. Required unless index is given. | |
| prefetchLimit | No | Hybrid only: hits the vector leg ranks before fusion, 1–10,000 (default 4 × (skip + limit)). | |
| scoreThreshold | No | Keep only results scoring at least this much (scores depend on the embedding model). | |
| similarityFunction | No | Disambiguates when multiple indexes share the same label+property+sourceType. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| total | Yes |