Update search.ts

This commit is contained in:
Nicolas 2024-05-04 13:09:11 -07:00
parent ce7bab7b35
commit 5229a4902b
1 changed files with 4 additions and 2 deletions

View File

@ -54,10 +54,12 @@ export async function searchHelper(
// filter out social media links // filter out social media links
console.log("Search results", searchOptions.limit);
const a = new WebScraperDataProvider(); const a = new WebScraperDataProvider();
await a.setOptions({ await a.setOptions({
mode: "single_urls", mode: "single_urls",
urls: res.map((r) => r.url), urls: res.map((r) => r.url).slice(0, searchOptions.limit ?? 7),
crawlerOptions: { crawlerOptions: {
...crawlerOptions, ...crawlerOptions,
}, },
@ -69,7 +71,7 @@ export async function searchHelper(
}, },
}); });
const docs = await a.getDocuments(true); const docs = await a.getDocuments(false);
if (docs.length === 0) { if (docs.length === 0) {
return { success: true, error: "No search results found", returnCode: 200 }; return { success: true, error: "No search results found", returnCode: 200 };
} }