From 39fc3d74b1e7e193442ab77962935fb50a593c5d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 3 May 2024 16:26:43 -0300 Subject: search: refactor search spec definition & interfaces --- src/static/js/search-worker.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/static/js/search-worker.js') diff --git a/src/static/js/search-worker.js b/src/static/js/search-worker.js index 166be2a2..0b3c8cc5 100644 --- a/src/static/js/search-worker.js +++ b/src/static/js/search-worker.js @@ -1,4 +1,4 @@ -import {makeSearchIndexes} from '../shared-util/searchSchema.js'; +import {makeSearchIndex, searchSpec} from '../shared-util/search-spec.js'; import {withEntries} from '../shared-util/sugar.js'; import FlexSearch from '../lib/flexsearch/flexsearch.bundle.module.min.js'; @@ -21,7 +21,11 @@ main().then( async function main() { indexes = - makeSearchIndexes(FlexSearch); + withEntries(searchSpec, entries => entries + .map(([key, descriptor]) => [ + key, + makeSearchIndex(descriptor, {FlexSearch}), + ])); searchData = await fetch('/search-data/index.json') -- cgit 1.3.0-6-gf8a5