> For the complete documentation index, see [llms.txt](https://docs.clickai.vn/clickai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clickai.vn/clickai-docs/clickai-docs-en/database/index-method-and-retrieval-settings.md).

# Index Method and Retrieval Settings

## Table of Contents

·       \[Select the Index Method]\(#select-the-index-method)

·       \[Configure the Retrieval Settings]\(#configure-the-retrieval-settings)

·       \[Q\&A Mode]\(#qa-mode)

&#x20;

## Select the Index Method

ClickAI provides 2 indexing methods:

### High Quality

·       Calls an Embedding Model to create vectors for each chunk

·       Enables semantic search (meaning-based retrieval)

·       Pros: Higher accuracy, better contextual understanding

·       Cons: Consumes embedding tokens, longer processing time

### Economical

·       Uses keyword indexing (inverted index) — a standard search engine technique

·       No embedding model needed, no token cost

·       Pros: Fast, no embedding cost

·       Cons: Keyword matching only, no contextual understanding

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Criteria</td><td valign="top">High Quality</td><td valign="top">Economical</td></tr><tr><td valign="top">Technology</td><td valign="top">Embedding vectors + keyword</td><td valign="top">Keyword indexing (inverted index)</td></tr><tr><td valign="top">Accuracy</td><td valign="top">High</td><td valign="top">Medium</td></tr><tr><td valign="top">Token cost</td><td valign="top">Yes (embedding)</td><td valign="top">No</td></tr><tr><td valign="top">Processing time</td><td valign="top">Longer</td><td valign="top">Faster</td></tr><tr><td valign="top">Semantic search</td><td valign="top">✅</td><td valign="top">❌</td></tr><tr><td valign="top">Multilingual search</td><td valign="top">✅</td><td valign="top">❌</td></tr></tbody></table>

&#x20;

💡 TIP: If you need highly accurate chatbot responses or handle multilingual content, choose \*\*High Quality\*\*. If speed and cost savings are priorities, choose \*\*Economical\*\*.

&#x20;

## Configure the Retrieval Settings

The Knowledge Base supports 2 core retrieval techniques:

1\.     Semantic Retrieval: Based on vector similarity — text chunks and queries are converted into vectors and matched via similarity scoring.

2\.     Keyword Matching: Using an inverted index (a standard search engine technique).

### Weight Settings

This feature enables you to set custom weights for semantic priority and keyword priority:

#### Semantic Value = 1 (Semantic Search Only)

·       Activates only semantic search mode

·       Uses embedding models to search deeper — even if exact query terms don't appear in the knowledge base

·       Calculates vector distances to return relevant content

·       Captures meaning across different languages for accurate cross-language results

#### Keyword Value = 1 (Keyword Search Only)

·       Activates only keyword search mode

·       Performs a full-text match against the knowledge base

·       Suitable when users know exact terminology

·       Consumes fewer resources, ideal for quick searches within large document repositories

#### Custom Keyword and Semantic Weights

Beyond enabling only semantic or keyword search, ClickAI provides flexible custom weight settings:

·       Continuously adjust weights of both methods

·       Identify the optimal weight ratio for your business scenario

### Rerank Model

·       Disabled by default. When enabled, a third-party Rerank model sorts the text chunks returned to optimize results

·       Helps the LLM access more precise information, improving output quality

·       Before enabling, go to Settings > Model Providers to configure the Rerank model API key

⚠️ IMPORTANT: If the selected embedding model is multimodal, select a multimodal rerank model (marked with a Vision icon) as well. Otherwise, retrieved images will be excluded from reranking.

📝 NOTE: Enabling Rerank will consume tokens from the Rerank model. Refer to the associated model's pricing page for details.

### TopK and Score Threshold

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Setting</td><td valign="top">Description</td><td valign="top">Default</td><td valign="top">Recommended</td></tr><tr><td valign="top">Top K</td><td valign="top">Maximum number of most similar chunks to retrieve</td><td valign="top">3</td><td valign="top">3-5</td></tr><tr><td valign="top">Score Threshold</td><td valign="top">Minimum similarity score for a chunk to be retrieved</td><td valign="top">0.5</td><td valign="top">0.5-0.7</td></tr></tbody></table>

&#x20;

·       Higher Top K → retrieves more chunks, but may include less relevant content

·       Higher Score Threshold → requires higher similarity, fewer but more accurate chunks returned

&#x20;

## Q\&A Mode

Q\&A Mode is a special option that lets ClickAI automatically analyze documents and generate question-answer pairs. Suitable for:

·       FAQ documents

·       Customer support documentation

·       Documents with clear Q\&A structure

&#x20;

*📖 Previous: \[Chunk Settings]\(./03-chunk-settings.md) · Next: \[Knowledge Pipeline]*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clickai.vn/clickai-docs/clickai-docs-en/database/index-method-and-retrieval-settings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
