mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 20:13:31 +08:00
Add missing matchCount
This commit is contained in:
parent
7593168032
commit
d0df82e8c3
@ -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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user