Aaron Ji commited on
Commit
02a219a
·
1 Parent(s): dd76cf3

fix: restrict auto-fill to first page fetch

Browse files
Files changed (1) hide show
  1. src/api/searcher-serper.ts +7 -1
src/api/searcher-serper.ts CHANGED
@@ -152,9 +152,15 @@ export class SearcherHost extends RPCHost {
152
 
153
  const crawlOpts = await this.crawler.configure(crawlerOptions);
154
  const searchQuery = searchExplicitOperators.addTo(q || noSlashPath);
 
 
 
 
 
 
155
  const r = await this.cachedWebSearch({
156
  q: searchQuery,
157
- num: count > 10 ? 30 : 20,
158
  gl,
159
  hl,
160
  location,
 
152
 
153
  const crawlOpts = await this.crawler.configure(crawlerOptions);
154
  const searchQuery = searchExplicitOperators.addTo(q || noSlashPath);
155
+
156
+ let fetchNum = count;
157
+ if ((page ?? 1) === 1) {
158
+ fetchNum = count > 10 ? 30 : 20;
159
+ }
160
+
161
  const r = await this.cachedWebSearch({
162
  q: searchQuery,
163
+ num: fetchNum,
164
  gl,
165
  hl,
166
  location,