AI Search now supports hybrid search and relevance boosting
AI Search adds hybrid search combining vector and keyword search in parallel, plus relevance boosting to control result rankings based on document metadata. Users can configure tokenizers, match modes, and fusion methods per instance or override on a per-request basis.
AI Search now supports hybrid search and relevance boosting, giving you more control over how results are found and ranked.
Hybrid search
Hybrid search combines vector (semantic) search with BM25 keyword search in a single query. Vector search finds chunks with similar meaning, even when the exact words differ. Keyword search matches chunks that contain your query terms exactly. When you enable hybrid search, both run in parallel and the results are fused into a single ranked list.
You can configure the tokenizer (porter for natural language, trigram for code), keyword match mode (and for precision, or for recall), and fusion method (rrf or max) per instance:
const instance = await env.AI_SEARCH.create({
id: "my-instance",
index_method: { vector: true, keyword: true },
fusion_method: "rrf",
indexing_options: { keyword_tokenizer: "porter" },
retrieval_options: { keyword_match_mode: "and" },
});
Refer to Search modes for an overview and Hybrid search for configuration details.
Relevance boosting
Relevance boosting lets you nudge search rankings based on document metadata. For example, you can prioritize recent documents by boosting on timestamp, or surface high-priority content by boosting on a custom metadata field like priority.
Configure up to 3 boost fields per instance or override them per request:
const results = await env.AI_SEARCH.get("my-instance").search({
messages: [{ role: "user", content: "deployment guide" }],
ai_search_options: {
retrieval: {
boost_by: [
{ field: "timestamp", direction: "desc" },
{ field: "priority", direction: "desc" },
],
},
},
});
Refer to Relevance boosting for configuration details.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for Windows hotfix - trusted certificate chains
A new GA release for Windows Cloudflare One Client is available, addressing an issue with building trusted certificate chains.
Cloudflare One Client for macOS - Trusted Certificate Chain Fix
A new GA release of the macOS Cloudflare One Client is available. This hotfix addresses an issue with building trusted certificate chains.
Cloudflare One Client for Linux
A new GA release of Cloudflare One Client for Linux is now available. This hotfix addresses an issue with building trusted certificate chains.