From 02a219a470d7c89e4fc97710b79d80542de9e0ff Mon Sep 17 00:00:00 2001 From: Aaron Ji Date: Fri, 14 Mar 2025 13:06:24 +0800 Subject: [PATCH] fix: restrict auto-fill to first page fetch --- src/api/searcher-serper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/searcher-serper.ts b/src/api/searcher-serper.ts index 1f88d37..0bb2d9d 100644 --- a/src/api/searcher-serper.ts +++ b/src/api/searcher-serper.ts @@ -152,9 +152,15 @@ export class SearcherHost extends RPCHost { const crawlOpts = await this.crawler.configure(crawlerOptions); const searchQuery = searchExplicitOperators.addTo(q || noSlashPath); + + let fetchNum = count; + if ((page ?? 1) === 1) { + fetchNum = count > 10 ? 30 : 20; + } + const r = await this.cachedWebSearch({ q: searchQuery, - num: count > 10 ? 30 : 20, + num: fetchNum, gl, hl, location,