From c364e42237493bf8985da23fdc394df735fe6c3f Mon Sep 17 00:00:00 2001 From: Gio Date: Tue, 26 Mar 2024 20:08:52 -0500 Subject: search, upd8: share schema between client and upd8 code --- src/static/js/client.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/static/js/client.js') diff --git a/src/static/js/client.js b/src/static/js/client.js index 075448a8..650a3925 100644 --- a/src/static/js/client.js +++ b/src/static/js/client.js @@ -7,6 +7,9 @@ import {accumulateSum, atOffset, empty, filterMultipleArrays, stitchArrays} from '../shared-util/sugar.js'; + +import FlexSearch from '../lib/flexsearch/flexsearch.bundle.module.min.js'; + import {fetchWithProgress} from './xhr-util.js'; const clientInfo = window.hsmusicClientInfo = Object.create(null); @@ -3419,25 +3422,9 @@ clientSteps.addPageListeners.push(addArtistExternalLinkTooltipPageListeners); // Internal search functionality -------------------------- async function initSearch() { - const {FlexSearch} = window; // Copied directly from server search.js - const indexes = { - albums: new FlexSearch.Document({ - id: "reference", - index: ["name", "groups"], - }), - - tracks: new FlexSearch.Document({ - id: "reference", - index: ["name", "album", "artists", "directory", "additionalNames"], - }), - - artists: new FlexSearch.Document({ - id: "reference", - index: ["names"], - }), - }; + const indexes = makeSearchIndexes(FlexSearch); window.indexes = indexes; -- cgit 1.3.0-6-gf8a5