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

# Indexing: BM25 full-text and IVF vector indexes

> Declare full-text BM25 and vector IVF indexes on your Infino tables, and pick the dimension and distance metric that match your embeddings.

You declare indexes once, at table creation, with an `IndexSpec`. Two index types,
chained fluently.

| Index            | Declare with                  | Powers                                      |
| ---------------- | ----------------------------- | ------------------------------------------- |
| Full-text (BM25) | `fts(column)`                 | keyword search, hybrid, the pushdown filter |
| Vector (IVF)     | `vector(column, dim, metric)` | semantic kNN, hybrid                        |

Declare both on a table to enable [hybrid search](/docs/guides/search#hybrid-search). Scalar columns
need no index; filter them with [SQL](/docs/sql-reference).

<CodeGroup>
  ```python Python icon="python" theme={null}
  spec = (
      infino.IndexSpec()
      .fts("body")                               # BM25 over `body`
      .vector("embedding", 384, "cosine")    # vector index over `embedding`
  )
  ```

  ```typescript Node.js icon="node-js" theme={null}
  const spec = new IndexSpec()
    .fts("body")                                 // BM25 over `body`
    .vector("embedding", 384, "cosine");     // vector index over `embedding`
  ```

  ```rust Rust icon="rust" theme={null}
  use infino::{IndexSpec, Metric};

  let spec = IndexSpec::new()
      .fts("body")                                  // BM25 over `body`
      .vector("embedding", 384, Metric::Cosine); // vector index over `embedding`
  ```
</CodeGroup>

## Full-text index: `fts(column)`

Builds a BM25 inverted index over a text column, powering `bm25_search`, `token_match`,
and the hybrid / pushdown-filter paths. Call `fts` once per text column you want to search.

## Vector index: `vector(column, dim, metric)`

Builds an IVF (inverted-file) vector index for kNN.

| Parameter | Type                                              | Description                                                                   |
| --------- | ------------------------------------------------- | ----------------------------------------------------------------------------- |
| `column`  | string                                            | the fixed-width vector column to index                                        |
| `dim`     | int                                               | embedding dimension; must match your model's output and the values you append |
| `metric`  | `cosine` / `l2sq` / `negdot` (`Metric::Cosine` …) | distance metric (see [Embeddings](/docs/guides/embeddings))                        |

**Partitioning is automatic.** The engine derives the IVF partition (centroid) count
from the data when the index is built, and it calibrates probe width and rerank budget
per table and per `k` at query time. There are no partition or probe knobs to set, and
the same declaration works from thousands of rows to hundreds of millions.

<Note>
  You can index multiple text columns (call `fts` per column) and multiple vector columns.
  **Scalar columns need no index declaration.** Filter them with SQL (`query_sql`) or as
  a pushdown pre-filter on vector search (see [Search](/docs/guides/search#vector-search)).
</Note>

## See also

* [Tables](/docs/guides/tables)
* [Search](/docs/guides/search#full-text-bm25)
* [Embeddings](/docs/guides/embeddings)
