mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 20:13:31 +08:00
Remove marker function
This commit is contained in:
parent
0c0b207667
commit
7e697d1857
@ -169,6 +169,7 @@ class Search {
|
|||||||
result.preview = Search.processMatches(result.content, contentMatches);
|
result.preview = Search.processMatches(result.content, contentMatches);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/// If there are no matches in the content, use the first 140 characters as preview
|
||||||
result.preview = replaceHTMLEnt(result.content.substring(0, 140));
|
result.preview = replaceHTMLEnt(result.content.substring(0, 140));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,16 +177,12 @@ class Search {
|
|||||||
if (result.matchCount > 0) results.push(result);
|
if (result.matchCount > 0) results.push(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Result with more matches appears first */
|
/// Result with more matches appears first
|
||||||
return results.sort((a, b) => {
|
return results.sort((a, b) => {
|
||||||
return b.matchCount - a.matchCount;
|
return b.matchCount - a.matchCount;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static marker(match) {
|
|
||||||
return '<mark>' + match + '</mark>';
|
|
||||||
}
|
|
||||||
|
|
||||||
private async doSearch(keywords: string[]) {
|
private async doSearch(keywords: string[]) {
|
||||||
const startTime = performance.now();
|
const startTime = performance.now();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user