Add missing matchCount

This commit is contained in:
Jimmy Cai 2021-12-29 14:01:19 +00:00 committed by GitHub
parent 7593168032
commit d0df82e8c3

View File

@ -137,7 +137,9 @@ class Search {
if (titleMatches.length > 0) result.title = Search.processMatches(result.title, titleMatches).join(''); 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 (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 */ /** Result with more matches appears first */