Fixed multi-terms search

This commit is contained in:
Simon Cambier
2022-04-11 10:41:06 +02:00
parent 7c96a15e15
commit 5ced77af5e
4 changed files with 5 additions and 4 deletions

View File

@@ -239,7 +239,7 @@ class OmnisearchModal extends SuggestModal<OmniNote> {
// Sort the terms from smaller to larger
// and highlight them in the title and body
const terms = result.terms.sort((a, b) => a.length - b.length)
const reg = new RegExp(escapeRegex(terms.join('|')), 'gi')
const reg = new RegExp(terms.map(escapeRegex).join('|'), 'gi')
body = body.replace(reg, highlighter)
title = title.replace(reg, highlighter)
name = name.replace(reg, highlighter)