1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-19 12:21:57 +02:00

proper light/compact bundle

This commit is contained in:
Thomas Wilkerling
2025-03-20 11:53:22 +01:00
parent b2c79cfd0e
commit 84c7a08e9e
60 changed files with 1591 additions and 2238 deletions

View File

@@ -1,14 +1,19 @@
import { Worker as WorkerIndex } from "flexsearch/esm";
const dirname = import.meta.dirname;
// you will need to keep the index configuration
// they will not export, also every change to the
// configuration requires a full re-index
const config = {
tokenize: "forward",
config: dirname + "/config.js"
};
(async function(){
// create a simple index which can store id-content-pairs
// and await (!) for the worker response
let index = await new WorkerIndex({
tokenize: "forward",
config: dirname + "/config.js"
});
let index = await new WorkerIndex(config);
// some test data
const data = [
@@ -44,15 +49,14 @@ const dirname = import.meta.dirname;
// do nothing here
});
index = await new WorkerIndex({
tokenize: "forward",
config: dirname + "/config.js"
});
// -----------------------
// IMPORT
// -----------------------
// create the same type of index you have used by .export()
// along with the same configuration
index = await new WorkerIndex(config);
await index.import();
// perform query