Remove marker function

This commit is contained in:
Jimmy Cai 2022-01-18 21:31:16 +00:00 committed by GitHub
parent 0c0b207667
commit 7e697d1857

View File

@ -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();