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

@@ -1,7 +1,7 @@
{
"id": "scambier.obsidian-omnisearch",
"name": "Omnisearch",
"version": "0.1.3",
"version": "0.1.4",
"minAppVersion": "0.14.2",
"description": "Search over organization",
"author": "Simon Cambier",

View File

@@ -1,6 +1,6 @@
{
"name": "scambier.obsidian-search",
"version": "0.1.3",
"version": "0.1.4",
"description": "Search over organization",
"main": "dist/main.js",
"scripts": {

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)

View File

@@ -2,5 +2,6 @@
"0.1.0": "0.14.2",
"0.1.1": "0.14.2",
"0.1.2": "0.14.2",
"0.1.3": "0.14.2"
"0.1.3": "0.14.2",
"0.1.4": "0.14.2"
}