Skip to content

Commit 41b55be

Browse files
committed
chunked export/import
1 parent 76d089b commit 41b55be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2172
-1711
lines changed

README.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ npm install git+https://github.com/nextapps-de/flexsearch/tree/v0.8-preview
2828
- Custom Score Function
2929
- Added French language preset (stop-word filter, stemmer)
3030
- Enhanced Worker Support
31+
- Export / Import index in chunks
3132
- Improved Build System + Bundler (Supported: CommonJS, ESM, Global Namespace), also the import of language packs are now supported for Node.js
3233
- Full covering index.d.ts type definitions
3334
- Fast-Boot Serialization optimized for Server-Side-Rendering (PHP, Python, Ruby, Rust, Java, Go, Node.js, ...)
@@ -2273,7 +2274,7 @@ A formula to determine a well-balanced value for the `resolution` is: $2*floor(\
22732274

22742275
> Persistent-Indexes and Worker-Indexes don't support Import/Export.
22752276
2276-
Export a simple `Index` to the folder `/export/`:
2277+
Export an `Index` or `Document-Index` to the folder `/export/`:
22772278

22782279
```js
22792280
import { promises as fs } from "fs";
@@ -2283,7 +2284,7 @@ await index.export(async function(key, data){
22832284
});
22842285
```
22852286

2286-
Import from folder `/export/` into a simple `Index`:
2287+
Import from folder `/export/` into an `Index` or `Document-Index`:
22872288

22882289
```js
22892290
const index = new Index({/* keep old config and place it here */});
@@ -2295,29 +2296,7 @@ for(let i = 0; i < files.length; i++){
22952296
}
22962297
```
22972298

2298-
This is very similar for document indexes.
2299-
2300-
Export a `Document-Index` to the folder `/export/`:
2301-
2302-
```js
2303-
import { promises as fs } from "fs";
2304-
2305-
await index.export(async function(key, data){
2306-
await fs.writeFile("./export/" + key, data, "utf8");
2307-
});
2308-
```
2309-
2310-
Import from folder `/export/` into a `Document-Index`:
2311-
2312-
```js
2313-
const index = new Document({/* keep old config and place it here */});
2314-
2315-
const files = await fs.readdir("./export/");
2316-
for(let i = 0; i < files.length; i++){
2317-
const data = await fs.readFile("./export/" + files[i], "utf8");
2318-
await index.import(files[i], data);
2319-
}
2320-
```
2299+
> You'll need to use the same configuration as you used before the export. Any changes on the configuration needs to be re-indexed.
23212300
23222301
## Migration
23232302

0 commit comments

Comments
 (0)