mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
fix(web.discover): cap results to top_k
This commit is contained in:
parent
43893fc1f8
commit
87df0bb629
2 changed files with 23 additions and 1 deletions
|
|
@ -27,7 +27,9 @@ def build_discover_executor(
|
|||
"(set a SearXNG host or a Linkup/Baidu key)."
|
||||
)
|
||||
hits = await provider.search(payload.query, payload.top_k)
|
||||
return DiscoverOutput(hits=hits)
|
||||
# Enforce the verb's documented cap here, once, for every provider:
|
||||
# some backends (e.g. SearXNG) treat `top_k` as a hint and over-return.
|
||||
return DiscoverOutput(hits=hits[: payload.top_k])
|
||||
|
||||
return execute
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue