Host FlexSearch

This commit is contained in:
Will Faught
2025-03-02 00:23:46 -08:00
parent 2e77b35940
commit 078157e62c
164 changed files with 23495 additions and 1 deletions

35
paige/node_modules/flexsearch/dist/node/node.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
const { parentPort } = require("worker_threads");
const { Index } = require("../flexsearch.bundle.min.js");
let index;
parentPort.on("message", function(data){
/** @type Index */
const args = data["args"];
const task = data["task"];
const id = data["id"];
switch(task){
case "init":
const options = data["options"] || {};
const encode = options["encode"];
options["cache"] = false;
if(encode && (encode.indexOf("function") === 0)){
options["encode"] = new Function("return " + encode)();
}
index = new Index(options);
break;
default:
const message = index[task].apply(index, args);
parentPort.postMessage(task === "search" ? { "id": id, "msg": message } : { "id": id });
}
});