From d0df82e8c36b917695ef12197f97d0672814beff Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Wed, 29 Dec 2021 14:01:19 +0000 Subject: [PATCH] Add missing matchCount --- assets/ts/search.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/ts/search.tsx b/assets/ts/search.tsx index 1960dbc..a661662 100644 --- a/assets/ts/search.tsx +++ b/assets/ts/search.tsx @@ -137,7 +137,9 @@ class Search { if (titleMatches.length > 0) result.title = Search.processMatches(result.title, titleMatches).join(''); if (contentMatches.length > 0) result.preview = Search.processMatches(result.content, contentMatches).join(''); - if (titleMatches.length > 0 || contentMatches.length > 0) results.push(result); + + result.matchCount = titleMatches.length + contentMatches.length; + if (result.matchCount > 0) results.push(result); } /** Result with more matches appears first */