***

title: IndexBuilder
slug: /reference/python/agents/search/index-builder
description: Build searchable vector indexes from document directories.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[sw-search]: /docs/server-sdks/reference/python/agents/cli/sw-search

[documentprocessor]: /docs/server-sdks/reference/python/agents/search/document-processor

[resolvemodelalias]: /docs/server-sdks/reference/python/agents/search/helpers

[buildindexfromsources]: /docs/server-sdks/reference/python/agents/search/index-builder/build-index-from-sources

[buildindex]: /docs/server-sdks/reference/python/agents/search/index-builder/build-index

[validateindex]: /docs/server-sdks/reference/python/agents/search/index-builder/validate-index

`IndexBuilder` processes document directories into searchable indexes. It handles
file discovery, text extraction, chunking, embedding generation, and storage into
either SQLite (`.swsearch` files) or pgvector backends. This is the programmatic
equivalent of the [`sw-search`][sw-search] CLI tool.

```python
from signalwire.search import IndexBuilder
```

<Warning>
  Requires search dependencies. Install with `pip install signalwire[search-full]`
  for full document processing support.
</Warning>

## **Properties**

<ParamField path="model_name" type="str" toc={true}>
  Name of the sentence transformer model used for embeddings.
</ParamField>

<ParamField path="chunking_strategy" type="str" toc={true}>
  Active chunking strategy passed to the internal `DocumentProcessor`.
</ParamField>

<ParamField path="backend" type="str" toc={true}>
  Storage backend. Either `"sqlite"` or `"pgvector"`.
</ParamField>

<ParamField path="doc_processor" type="DocumentProcessor" toc={true}>
  The [`DocumentProcessor`][documentprocessor]
  instance used for chunking.
</ParamField>

<ParamField path="model" type="SentenceTransformer | None" toc={true}>
  The loaded sentence transformer model. `None` until the first call to
  `build_index()` or `build_index_from_sources()`.
</ParamField>

## **Methods**

<CardGroup cols={2}>
  <Card title="build_index_from_sources" href="/docs/server-sdks/reference/python/agents/search/index-builder/build-index-from-sources">
    Build a complete search index from multiple source files and directories.
  </Card>

  <Card title="build_index" href="/docs/server-sdks/reference/python/agents/search/index-builder/build-index">
    Build a search index from a single directory.
  </Card>

  <Card title="validate_index" href="/docs/server-sdks/reference/python/agents/search/index-builder/validate-index">
    Validate an existing .swsearch index file.
  </Card>
</CardGroup>