Skip to content

Commit d524db4

Browse files
committed
Pass output directory to search script
1 parent f6aaebc commit d524db4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

javascript/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ async function main() {
312312
console.log("setup snippets and references done\n");
313313

314314
await recursiveXmlToHtmlInOrder("parseXml");
315-
writeRewritedSearchData();
315+
writeRewritedSearchData(outputDir);
316316
// this is meant to be temp; also, will remove the original "generateSearchData" after the updation at the frontend is completed.
317317
//testIndexSearch();
318318
}

javascript/searchRewrite.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "node:fs";
2+
import path from "node:path";
23
import { insert, TrieNode } from "./search/TrieNode.js";
34

45
// line 3 to 68: trie implementation and search functions
@@ -250,12 +251,12 @@ const buildTextTrie = () => {
250251
}
251252
};
252253

253-
export const writeRewritedSearchData = () => {
254+
export const writeRewritedSearchData = (outputDir: string) => {
254255
buildTextTrie();
255256

256257
const searchData = { indexTrie, textTrie, idToContentMap };
257258
fs.writeFile(
258-
"json/rewritedSearchData.json",
259+
path.join(outputDir, "rewritedSearchData.json"),
259260
JSON.stringify(searchData),
260261
err => {
261262
if (err) {

0 commit comments

Comments
 (0)