fix: improve search to only match title and excerpt, not raw HTML content
This commit is contained in:
+7
-2
@@ -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[]>
|
||||
|
||||
Reference in New Issue
Block a user