« get me outta code hell

client: wiki-search: don't match kind terms inside other words - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-22 10:46:21 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-22 10:46:21 -0300
commit7eecc9a218499dd5c9c0ac4e04c04bf079a7587f (patch)
treea40e37335a3946889c8dbcfdc372cf46baeb1008
parentd586a103e694b4cb229268410899bf0d9a227497 (diff)
client: wiki-search: don't match kind terms inside other words
-rw-r--r--src/static/js/search-worker.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/static/js/search-worker.js b/src/static/js/search-worker.js
index 1b0f26de..1e684adc 100644
--- a/src/static/js/search-worker.js
+++ b/src/static/js/search-worker.js
@@ -615,7 +615,7 @@ function processTerms(query) {
 
   const termRegexp =
     new RegExp(
-      String.raw`(?<kind>${kindTermSpec.flatMap(spec => spec.terms).join('|')})` +
+      String.raw`(?<kind>(?<=^|\s)(?:${kindTermSpec.flatMap(spec => spec.terms).join('|')})(?=$|\s))` +
       String.raw`|(?<=^|\s)(?<quote>["'])(?<regularVerbatim>.+?)\k<quote>(?=$|\s)` +
       String.raw`|(?<=^|\s)[“”‘’](?<curlyVerbatim>.+?)[“”‘’](?=$|\s)` +
       String.raw`|[^\s\-]+`,