Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

[METABOT] Use `limit` in final search response (#64336)

Tyler Pludecc6827ae8c3c
diff --git a/enterprise/backend/src/metabase_enterprise/metabot_v3/tools/search.clj b/enterprise/backend/src/metabase_enterprise/metabot_v3/tools/search.clj
index e8078c6f679..32b394bfe80 100644
--- a/enterprise/backend/src/metabase_enterprise/metabot_v3/tools/search.clj
+++ b/enterprise/backend/src/metabase_enterprise/metabot_v3/tools/search.clj
@@ -107,6 +107,7 @@
use-verified-content? (if metabot-id
(:use_verified_content metabot)
false)
+ limit (or limit 50)
search-fn (fn [query]
(let [search-context (search/search-context
(merge
@@ -122,7 +123,7 @@
:current-user-perms @api/*current-user-permissions-set*
:context :metabot
:archived false
- :limit (or limit 50)
+ :limit limit
:offset 0}
(when use-verified-content?
{:verified true})))
@@ -131,5 +132,5 @@
;; Create futures for parallel execution
futures (mapv #(future (search-fn %)) all-queries)
result-lists (mapv deref futures)
- fused-results (reciprocal-rank-fusion result-lists)]
+ fused-results (take limit (reciprocal-rank-fusion result-lists))]
(map transform-search-result fused-results)))