From 2360483964d957a994fa9c738c676dbb88233f47 Mon Sep 17 00:00:00 2001 From: rszyma <44318430+rszyma@users.noreply.github.com> Date: Tue, 30 May 2023 15:15:16 +0200 Subject: [PATCH] cheat-sheet: boost the part after last `-` --- cheat-sheet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cheat-sheet.js b/cheat-sheet.js index e9e4d63cd..02c4cbafb 100644 --- a/cheat-sheet.js +++ b/cheat-sheet.js @@ -9,7 +9,7 @@ document.addEventListener('DOMContentLoaded', function () { // Index all glyphs/icons let miniSearch = new MiniSearch({ - fields: ['id', 'code'], // fields to index for full-text search + fields: ['id', 'code', 'name'], // fields to index for full-text search storeFields: ['id', 'code', 'isRemoved'], // fields to return with search results }) miniSearch.addAll(Object.entries(glyphs).map( @@ -17,6 +17,7 @@ document.addEventListener('DOMContentLoaded', function () { return { id: key, code: value, + name: key.substring(key.lastIndexOf('-') + 1), isRemoved: key.startsWith('nfold'), } } @@ -134,6 +135,7 @@ document.addEventListener('DOMContentLoaded', function () { { prefix: true, combineWith: "AND", + boost: {id: 0.001}, boostDocument: ((documentId, term, storedFields) => { return storedFields.isRemoved ? 0.001 : 1 }),