diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-26 15:34:12 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-31 12:11:44 -0300 |
commit | d1f036182b17b9e27c986e152949a75187d8eb07 (patch) | |
tree | 813c00c9887f56cf8362d9d32a9b21a169ceed3d /src/data/things | |
parent | fa969b9dd99d18a3c5f77300a79a9c923ce280ce (diff) |
search: output to wikiCachePath/search/index.json
Diffstat (limited to 'src/data/things')
-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.`; |