diff --git a/src/services/search.service.ts b/src/services/search.service.ts index 5901bbc..0efa3c3 100644 --- a/src/services/search.service.ts +++ b/src/services/search.service.ts @@ -53,7 +53,12 @@ const searchContent = async (query: string, index: number, limit: number) => { contentSnippetLength * 2 + query.length }), '...', '') ), - null + CONCAT( + SUBSTRING(feed.content, 1, ${contentSnippetLength * 2 + query.length}), + IF(LENGTH(feed.content) > (GREATEST(1, LOCATE(LOWER(:originQuery), LOWER(feed.content)) - ${contentSnippetLength}) + ${ + contentSnippetLength * 2 + query.length + }), '...', '') + ) ) AS contentSnippet`, ]) .where(