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

# TFIDFVectoria Constructor

> Create a zero-dependency TF-IDF search index

Create a zero-dependency TF-IDF search index for keyword-based search.

## Signature

```ts theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
constructor(config?: TFIDFConfig)
```

## Parameters

### TFIDFConfig

```ts theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
interface TFIDFConfig {
  defaultSimilarityThreshold?: number;
  defaultTopK?: number;
}
```

| Option                       | Type     | Default | Description                |
| ---------------------------- | -------- | ------- | -------------------------- |
| `defaultSimilarityThreshold` | `number` | `0.0`   | Default minimum similarity |
| `defaultTopK`                | `number` | `10`    | Default results limit      |

## Example

```ts theme={"theme":{"light":"snazzy-light","dark":"dark-plus"}}
import { TFIDFVectoria, DocumentMetadata } from 'vectoriadb';

interface ToolDocument extends DocumentMetadata {
  toolName: string;
  category: string;
}

const db = new TFIDFVectoria<ToolDocument>({
  defaultSimilarityThreshold: 0.0,
  defaultTopK: 10,
});
```

## Key Differences from VectoriaDB

| Feature          | TFIDFVectoria | VectoriaDB      |
| ---------------- | ------------- | --------------- |
| Dependencies     | Zero          | transformers.js |
| Initialization   | Synchronous   | Async           |
| Understanding    | Keyword-based | Semantic        |
| Reindex required | Yes           | No              |

## When to Use

Use TFIDFVectoria when:

* You need zero dependencies
* Keyword matching is sufficient
* No network access for model download
* Small corpus (\< 10K documents)

## Related

<CardGroup cols={2}>
  <Card title="TFIDFVectoria Methods" icon="code" href="/vectoriadb/api-reference/tfidf-vectoria/methods">
    All methods
  </Card>

  <Card title="TF-IDF Guide" icon="text" href="/vectoriadb/guides/alternatives/tfidf">
    Usage guide
  </Card>
</CardGroup>
