diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/search.js | 8 |
1 files changed, 6 insertions, 2 deletions
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.`; |