Fixed multi-terms search
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user