Search Strategy and Tuning
Understand the current Hybrid Search flow, retrieval scores, and how to tune Limit, Top K, and Min score.
UnieAI Studio currently uses Hybrid Search for every knowledge-base query. Each search runs semantic vector retrieval and BM25 lexical retrieval, then merges, filters, and ranks the results.
Semantic, Full-Text, and Hybrid are not selectable modes. The Studio search page and POST /v1/kb/search accept only hybrid; other modes are rejected.
Dense Search
The system converts the query into an embedding and uses Milvus Cosine Search to find semantically similar chunks. Conceptually related content can be found even when the query and document use different wording.
BM25 Search
Milvus Sparse Search uses BM25 to find chunks containing important terms. It is especially useful for product models, error codes, regulation numbers, names, and other exact strings. A BM25-only match can enter the final ranking even when Dense Search did not retrieve it.
Hybrid Score
Runtime blends the Dense and BM25 signals and adds a small boost when the complete query string appears in a chunk. BM25 values are normalized against the candidates for that query, so the displayed score is a hybrid relevance score, not a raw Cosine score.
Do not treat scores from different queries as directly comparable absolute quality values. Tune Min score with representative questions and expected results instead of applying one universal threshold.
Test search in a knowledge base
Open My Knowledge Bases and select the knowledge base you want to test.
Confirm that the target documents finished parsing and indexing, then open Search from the files page.
Enter a question that a real user would ask, configure Limit and Min score, then select Search.
Inspect the returned chunks, document names, pages, scores, and metadata. Image or figure chunks can also include a preview that you can open.
The right side of the Search page also provides cURL, Python, and Remote MCP examples for the current knowledge base, so you can validate external integrations with the same parameters.
Available parameters
| Parameter | Search-page default | Range | Description |
|---|---|---|---|
| Limit | 8 | 1–50 | Maximum chunks returned by this knowledge-base search |
| Min score | 0.18 | 0–1 | Excludes chunks whose Hybrid Score is below this value |
| Mode | hybrid | hybrid only | Runs Dense Cosine and BM25 retrieval together |
Tune Limit
- Increase Limit when too few results are returned or an answer must combine several passages.
- Lower Limit when results contain too much unrelated content, latency increases, or the context becomes too large.
- Limit counts chunks, not documents. One document can contribute several chunks.
Tune Min score
- Lower Min score gradually when an expected chunk is missing.
- Raise Min score gradually when too many weakly related chunks are returned.
- Start from
0.18, then tune with a test set containing both queries that should match and queries that should not match.
Search Limit versus model Top K
These settings are related but apply in different places:
| Location | Parameter | Purpose |
|---|---|---|
| Knowledge base → Search | Limit, default 8 | Controls only the results from this Search-page or knowledge-base API request |
| Customize Model → Behavior → Agent Loop | Top K results, default 5 | Controls the chunks Runtime ultimately supplies to the LLM during the model RAG flow |
Changing Limit or Min score on the Search page does not update the Customize Model. To change retrieval during actual model conversations, update Top K and Min score under Behavior → Agent Loop. Model settings are saved automatically.
Query-design guidance
Use a complete question similar to what a real user would ask. Dense Search can find semantic matches, while BM25 retains the important terms in the question.
Preserve the spelling used in the document when searching for a model number, clause, error code, or version. BM25 and the exact-string boost can rank these chunks more highly.
If the complete question returns nothing, first search for a distinctive term that definitely exists in the document, then move gradually back to the natural-language question. This separates indexing, threshold, and query-wording problems.
Read search results
Important information in each result includes:
content: the chunk content available to downstream processing.score: the blended Hybrid relevance score.documentId, document name, andchunkId: the result source and chunk identifiers.pageIndex,chunkIndex, and section information: the chunk position in the document.- Metadata and image previews: source, format, or visual information retained during parsing.
Keyword highlighting is only a reading aid on the Search page. It does not mean that the final score is calculated only from highlighted words.