Skip to main content
The VectorSearch service queries vector indexes defined in your schema. It is only available in actions.
import { Effect } from "effect";
import { VectorSearch } from "./confect/_generated/services";

Effect.gen(function* () {
  const vectorSearch = yield* VectorSearch;

  const results = yield* vectorSearch("notes", "embedding", {
    vector: embeddingVector,
    limit: 10,
    filter: (q) => q.eq("tag", "colors"),
  });
});
Each result contains the document’s _id and a _score representing similarity (higher is more similar).
Array<{ _id: GenericId<TableName>; _score: number }>;
Vector indexes are defined on tables using the vectorIndex method. See the Schema page for an example. For more details on vector search queries and index configuration, see the Convex vector search documentation. Full-text search uses search indexes via the DatabaseReader service, not the VectorSearch service. See the Reading page for usage.