> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-en/km/test-search-result.md).

# Search Testing

## Why Do You Need Search Testing?

1. **Ensure Response Accuracy**

* The quality of AI assistant responses directly affects customer satisfaction
* Incorrect or irrelevant answers damage brand trust

2. **Avoid Information Gaps**

* Prevent important product details or safety instructions from being overlooked
* Optimize the efficiency of knowledge base usage

3. **Improve Q\&A Consistency**

* Ensure the same question receives a consistent answer at different times
* Avoid response instability caused by knowledge base updates

Through search testing and segment preview features, you can instantly review the quality of data segments used by the AI assistant to ensure your Q\&A standards.

## How to Get Started?

1. Go to the Knowledge Base page, select the knowledge base you want to view, and enter its settings
2. Click on Search Test to enter the page

Type the content you want to search in the dialog box: "What should I pay attention to when choosing a campsite?", then click the search button. The AI assistant will search for the most relevant documents based on your input.

<figure><img src="/files/ID5uoF2iSYL76LnPxyzP" alt=""><figcaption></figcaption></figure>

3. View search results

The right side will display the segments that the AI assistant retrieves when answering. As shown in the figure, there are 12 segments (to configure the number of retrieved segments, refer to: [How to Create a Knowledge Base: Basic Settings](/maiagent-user-guide/maiagent-user-guide-en/km/km-basic-settings.md#jian-suo-pian-duan))

<figure><img src="/files/4Btkr6va8AZUWbwWM49S" alt=""><figcaption></figcaption></figure>

The right side shows the retrieved content used to answer this question. Each segment displays:

* Word count: The number of words covered by the segment
* Hit count: The number of times the AI assistant referenced this segment when answering (only official Q\&A sessions are counted; test Q\&A sessions are not included in hit count calculations)

  A higher hit count indicates that users ask more questions related to this segment.

Search test records past test Q\&A sessions. You can quickly click on history records to retest, ensuring that the same topics maintain or improve data reference quality.

<figure><img src="/files/xHzItTJD5JG0BV98MCwC" alt=""><figcaption></figcaption></figure>

## Check Knowledge Segment Quality

Through search testing, you can determine which segments the AI assistant uses during reasoning, and then check whether the content of these segments needs optimization, such as:

<figure><img src="/files/1GQ1FT6PJ4HnPGy8ejic" alt=""><figcaption></figcaption></figure>

If you find many blank segments in the search results, and these blank segments all belong to the file "<mark style="color:blue;">Beginner Camping.pdf</mark>", you can then check whether the content of "<mark style="color:blue;">Beginner Camping.pdf</mark>" is correct and update it immediately **before going live**.

## Search Test by Metadata

### What Is Metadata Search?

The Metadata search feature allows you to perform precise queries based on document attribute information, rather than being limited to the document content itself. This feature is particularly suitable for:

* **Document classification queries**: Search by document type, tags, categories, and other information
* **Attribute filtering**: Filter by document creation time, author, source, and other attributes
* **Precise targeting**: Quickly find document collections that meet specific criteria

### How to Use Metadata Search?

On the search test page, you can:

1. **Select search mode**: Switch to "Metadata Search" mode
2. **Specify search criteria**: Enter the metadata field and value you want to search
3. **View search results**: The system will display document segments that match the metadata criteria

**Search examples:**

* Search for documents in a specific category: `category:Product Description`
* Search for documents within a specific time range: `date:2025-01`
* Search for documents by a specific author: `author:Customer Service Department`

### Advantages of Metadata Search

**1. More Precise Results**

* Query directly against document attributes, reducing irrelevant results
* Suitable for scenarios that require precise filtering

**2. Faster Targeting**

* No need for full-text search; quickly locate target documents
* Especially suitable for knowledge bases with large volumes of documents

**3. Combined with Content Search**

* Can be used in combination with regular content search
* First narrow down the scope with metadata, then pinpoint with content search

### Practical Use Cases

**Scenario 1: Product Document Management**

* Search for all documents in a specific product line
* Example: `product_line:Camping Equipment`

**Scenario 2: Time Range Query**

* Find recently updated documents
* Example: `updated_date:2025-11`

**Scenario 3: Document Type Filtering**

* View only specific types of documents (e.g., operation manuals, FAQs, etc.)
* Example: `doc_type:FAQ`

## Search Testing Helps You

### Test Important Questions Regularly

* Test core business-related questions frequently
* Retest after knowledge base updates
* Record and compare improvements in test results

### Identify Content Gaps

* Discover knowledge gaps: Test common questions and find queries with no matching results
* Example: Testing "tent waterproof rating explanation" reveals no relevant segments → waterproof specification documents need to be added

### Evaluate Content Completeness

* Check answer depth: Confirm whether the AI answer covers all aspects of the question
* Example: Query "camping safety precautions" → Check whether it covers weather, wildlife, fire safety, and other aspects

## Question Testing Tips

You can:

* Ask the same question in different ways
* Test complex scenarios and multi-condition queries
* Verify the retrieval effectiveness of technical terms and product names

Use these testing tips to comprehensively evaluate the accuracy and completeness of responses.


---

# 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.maiagent.ai/maiagent-user-guide/maiagent-user-guide-en/km/test-search-result.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.
