nomagick commited on
Commit
20a7d4d
·
unverified ·
1 Parent(s): 1ca29b4

fix: search return amount

Browse files
backend/functions/src/cloud-functions/searcher-serper.ts CHANGED
@@ -147,7 +147,7 @@ export class SearcherHost extends RPCHost {
147
  const searchQuery = searchExplicitOperators.addTo(q || noSlashPath);
148
  const r = await this.cachedWebSearch({
149
  q: searchQuery,
150
- num: count ? (isVersion2 ? count : Math.min(Math.floor(count + 2), 12)) : 12
151
  }, crawlerOptions.noCache);
152
 
153
  if (!r.organic.length) {
@@ -161,7 +161,7 @@ export class SearcherHost extends RPCHost {
161
  if (isVersion2) {
162
  chargeAmount = 10000;
163
  const result = [];
164
- for (const x of r.organic) {
165
  const url = new URL(x.link);
166
  const favicon = await this.getFavicon(url.origin);
167
 
@@ -481,7 +481,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n')}\n` : ''}`;
481
  return _.every(results, (x) => this.pageQualified(x)) && results.length >= targetResultCount;
482
  }
483
 
484
- async getFavicon (domain: string) {
485
  const url = `https://www.google.com/s2/favicons?sz=32&domain_url=${domain}`;
486
 
487
  try {
 
147
  const searchQuery = searchExplicitOperators.addTo(q || noSlashPath);
148
  const r = await this.cachedWebSearch({
149
  q: searchQuery,
150
+ num: count > 10 ? 20 : 10
151
  }, crawlerOptions.noCache);
152
 
153
  if (!r.organic.length) {
 
161
  if (isVersion2) {
162
  chargeAmount = 10000;
163
  const result = [];
164
+ for (const x of r.organic.slice(0, count)) {
165
  const url = new URL(x.link);
166
  const favicon = await this.getFavicon(url.origin);
167
 
 
481
  return _.every(results, (x) => this.pageQualified(x)) && results.length >= targetResultCount;
482
  }
483
 
484
+ async getFavicon(domain: string) {
485
  const url = `https://www.google.com/s2/favicons?sz=32&domain_url=${domain}`;
486
 
487
  try {
thinapps-shared CHANGED
@@ -1 +1 @@
1
- Subproject commit b5e688359eaa87538ef5f43c1323ab92eca8ea33
 
1
+ Subproject commit b37a272c11bffc6484715594f8f285ac50e461dd