diff --git a/apps/docs/app/api/search/route.ts b/apps/docs/app/api/search/route.ts index 848ced297..83de50297 100644 --- a/apps/docs/app/api/search/route.ts +++ b/apps/docs/app/api/search/route.ts @@ -36,14 +36,15 @@ export async function GET(req: NextRequest) { const db = await getDb() const searchForArticle = await db.db.prepare( ` - SELECT id, title, sectionId, categoryId, content + SELECT id, title, sectionId, categoryId, content, keywords FROM ftsArticles - WHERE ftsArticles MATCH ? + WHERE ftsArticles MATCH ? OR keywords MATCH ? ORDER BY bm25(ftsArticles, 1000.0) `, - query + [query, query] ) + await searchForArticle.all().then(async (queryResults) => { for (const article of queryResults) { const section = await db.getSection(article.sectionId)