From d1f036182b17b9e27c986e152949a75187d8eb07 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 26 Mar 2024 15:34:12 -0300 Subject: search: output to wikiCachePath/search/index.json --- src/data/things/search.js | 8 ++++++-- src/upd8.js | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/data/things/search.js b/src/data/things/search.js index ed65cb6b..7dcf5cf9 100644 --- a/src/data/things/search.js +++ b/src/data/things/search.js @@ -1,6 +1,6 @@ 'use strict'; -import {writeFile} from 'node:fs/promises'; +import {mkdir, writeFile} from 'node:fs/promises'; import * as path from 'node:path'; import FlexSearch from 'flexsearch'; @@ -86,9 +86,13 @@ export async function writeSearchIndex({ }); })); + const outputDirectory = + path.join(wikiCachePath, 'search'); + const outputFile = - path.join(wikiCachePath, 'search-index.json'); + path.join(outputDirectory, 'index.json'); + await mkdir(outputDirectory, {recursive: true}); await writeFile(outputFile, JSON.stringify(searchData)); logInfo`Search index successfully written.`; diff --git a/src/upd8.js b/src/upd8.js index 473a9514..3dc01da8 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -2264,6 +2264,7 @@ async function main() { dataPath, mediaPath, mediaCachePath, + wikiCachePath, queueSize, srcRootPath: __dirname, -- cgit 1.3.0-6-gf8a5