{"id":377,"date":"2026-04-16T12:00:00","date_gmt":"2026-04-16T12:00:00","guid":{"rendered":"https:\/\/wordpress.securinsight.ca\/index.php\/2026\/04\/16\/ai-search-ai-search-now-has-hybrid-search-and-relevance-boosting\/"},"modified":"2026-04-16T12:00:00","modified_gmt":"2026-04-16T12:00:00","slug":"ai-search-ai-search-now-has-hybrid-search-and-relevance-boosting","status":"publish","type":"post","link":"https:\/\/wordpress.securinsight.ca\/index.php\/2026\/04\/16\/ai-search-ai-search-now-has-hybrid-search-and-relevance-boosting\/","title":{"rendered":"AI Search &#8211; AI Search now has hybrid search and relevance boosting"},"content":{"rendered":"<p><a href=\"https:\/\/developers.cloudflare.com\/ai-search\/\">AI Search<\/a> now supports hybrid search and relevance boosting, giving you more control over how results are found and ranked.<\/p>\n<h4>Hybrid search<\/h4>\n<p>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.<\/p>\n<p>You can configure the tokenizer (<code>porter<\/code> for natural language, <code>trigram<\/code> for code), keyword match mode (<code>and<\/code> for precision, <code>or<\/code> for recall), and fusion method (<code>rrf<\/code> or <code>max<\/code>) per instance:<\/p>\n<div>\n<figure>\n<pre data-language=\"ts\"><code class=\"language-ts\"><div><div><span>const<\/span><span> <\/span><span>instance<\/span><span> <\/span><span>=<\/span><span> <\/span><span>await<\/span><span> <\/span><span>env<\/span><span>.<\/span><span>AI_SEARCH<\/span><span>.<\/span><span>create<\/span><span>(<\/span><span>{<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>id<\/span><span>:<\/span><span> <\/span><span>\"my-instance\"<\/span><span>,<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>index_method<\/span><span>:<\/span><span> <\/span><span>{<\/span><span> vector<\/span><span>:<\/span><span> true<\/span><span>,<\/span><span> keyword<\/span><span>:<\/span><span> true <\/span><span>},<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>fusion_method<\/span><span>:<\/span><span> <\/span><span>\"rrf\"<\/span><span>,<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>indexing_options<\/span><span>:<\/span><span> <\/span><span>{<\/span><span> keyword_tokenizer<\/span><span>:<\/span><span> <\/span><span>\"porter\"<\/span><span> <\/span><span>},<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>retrieval_options<\/span><span>:<\/span><span> <\/span><span>{<\/span><span> keyword_match_mode<\/span><span>:<\/span><span> <\/span><span>\"and\"<\/span><span> <\/span><span>},<\/span><\/div><\/div><div><div><span>}<\/span><span>)<\/span><span>;<\/span><\/div><\/div><\/code><\/pre>\n<div>\n<div><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<p>Refer to <a href=\"https:\/\/developers.cloudflare.com\/ai-search\/concepts\/search-modes\/\">Search modes<\/a> for an overview and <a href=\"https:\/\/developers.cloudflare.com\/ai-search\/configuration\/indexing\/hybrid-search\/\">Hybrid search<\/a> for configuration details.<\/p>\n<h4>Relevance boosting<\/h4>\n<p>Relevance boosting lets you nudge search rankings based on document metadata. For example, you can prioritize recent documents by boosting on <code>timestamp<\/code>, or surface high-priority content by boosting on a custom metadata field like <code>priority<\/code>.<\/p>\n<p>Configure up to 3 boost fields per instance or override them per request:<\/p>\n<div>\n<figure>\n<pre data-language=\"ts\"><code class=\"language-ts\"><div><div><span>const<\/span><span> <\/span><span>results<\/span><span> <\/span><span>=<\/span><span> <\/span><span>await<\/span><span> <\/span><span>env<\/span><span>.<\/span><span>AI_SEARCH<\/span><span>.<\/span><span>get<\/span><span>(<\/span><span>\"my-instance\"<\/span><span>)<\/span><span>.<\/span><span>search<\/span><span>(<\/span><span>{<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>messages<\/span><span>:<\/span><span> [<\/span><span>{<\/span><span> role<\/span><span>:<\/span><span> <\/span><span>\"user\"<\/span><span>,<\/span><span> content<\/span><span>:<\/span><span> <\/span><span>\"deployment guide\"<\/span><span> <\/span><span>}<\/span><span>]<\/span><span>,<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>ai_search_options<\/span><span>:<\/span><span> <\/span><span>{<\/span><\/div><\/div><div><div><span><span>    <\/span><\/span><span>retrieval<\/span><span>:<\/span><span> <\/span><span>{<\/span><\/div><\/div><div><div><span><span>      <\/span><\/span><span>boost_by<\/span><span>:<\/span><span> [<\/span><\/div><\/div><div><div><span>        <\/span><span>{<\/span><span> field<\/span><span>:<\/span><span> <\/span><span>\"timestamp\"<\/span><span>,<\/span><span> direction<\/span><span>:<\/span><span> <\/span><span>\"desc\"<\/span><span> <\/span><span>},<\/span><\/div><\/div><div><div><span>        <\/span><span>{<\/span><span> field<\/span><span>:<\/span><span> <\/span><span>\"priority\"<\/span><span>,<\/span><span> direction<\/span><span>:<\/span><span> <\/span><span>\"desc\"<\/span><span> <\/span><span>},<\/span><\/div><\/div><div><div><span><span>      <\/span><\/span><span>]<\/span><span>,<\/span><\/div><\/div><div><div><span>    <\/span><span>},<\/span><\/div><\/div><div><div><span>  <\/span><span>},<\/span><\/div><\/div><div><div><span>}<\/span><span>)<\/span><span>;<\/span><\/div><\/div><\/code><\/pre>\n<div>\n<div><\/div>\n<\/div>\n<div><\/div>\n<\/figure>\n<\/div>\n<p>Refer to <a href=\"https:\/\/developers.cloudflare.com\/ai-search\/configuration\/retrieval\/boosting\/\">Relevance boosting<\/a> for configuration details.<\/p>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-377","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/comments?post=377"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/377\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/media?parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/categories?post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/tags?post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}