fix: improve search to only match title and excerpt, not raw HTML content

This commit is contained in:
achmad
2026-05-28 23:35:15 +07:00
parent c4ed4a3615
commit cd5a7d31c6
2 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -144,8 +144,13 @@ export async function searchArticles(query: string): Promise<Article[]> {
return getClient().request(
readItems('articles', {
fields: ['id', 'title', 'slug', 'category.slug', 'category.name'],
search: query,
filter: { status: { _eq: 'published' } },
filter: {
_or: [
{ title: { _icontains: query } },
{ excerpt: { _icontains: query } },
],
status: { _eq: 'published' },
},
limit: 8,
})
) as Promise<Article[]>