> ## Documentation Index
> Fetch the complete documentation index at: https://confect.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> Query vector indexes for semantic similarity search.

## Vector search

The `VectorSearch` service queries vector indexes defined in your [schema](/server/database/schema). It is only available in actions.

```ts theme={null}
import * as Effect from "effect/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).

```ts theme={null}
Array<{ _id: GenericId<TableName>; _score: number }>;
```

Vector indexes are defined on tables using the `vectorIndex` method. See the [Schema](/server/database/schema) page for an example.

For more details on vector search queries and index configuration, see the [Convex vector search documentation](https://docs.convex.dev/search/vector-search).

## Full-text search

Full-text search uses search indexes via the `DatabaseReader` service, not the `VectorSearch` service. See the [Reading](/server/database/reading) page for usage.
