fix: search return amount

This commit is contained in:
Yanlong Wang 2025-02-27 09:03:21 +08:00
parent 1ca29b4b0e
commit 20a7d4d538
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37
2 changed files with 4 additions and 4 deletions

View File

@ -147,7 +147,7 @@ export class SearcherHost extends RPCHost {
const searchQuery = searchExplicitOperators.addTo(q || noSlashPath);
const r = await this.cachedWebSearch({
q: searchQuery,
num: count ? (isVersion2 ? count : Math.min(Math.floor(count + 2), 12)) : 12
num: count > 10 ? 20 : 10
}, crawlerOptions.noCache);
if (!r.organic.length) {
@ -161,7 +161,7 @@ export class SearcherHost extends RPCHost {
if (isVersion2) {
chargeAmount = 10000;
const result = [];
for (const x of r.organic) {
for (const x of r.organic.slice(0, count)) {
const url = new URL(x.link);
const favicon = await this.getFavicon(url.origin);
@ -481,7 +481,7 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n')}\n` : ''}`;
return _.every(results, (x) => this.pageQualified(x)) && results.length >= targetResultCount;
}
async getFavicon (domain: string) {
async getFavicon(domain: string) {
const url = `https://www.google.com/s2/favicons?sz=32&domain_url=${domain}`;
try {

@ -1 +1 @@
Subproject commit b5e688359eaa87538ef5f43c1323ab92eca8ea33
Subproject commit b37a272c11bffc6484715594f8f285ac50e461dd