@yoch/frozenminisearch 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v1.2.1 — `@yoch/frozenminisearch`
6
+
7
+ Patch release: lower search overhead when stored fields are disabled and fewer query-normalization allocations. No API or MSv5 wire-format changes.
8
+
9
+ ### Improved
10
+
11
+ - **Search without `storeFields`** — skip stored-field reads during scoring and result finalization when the index has no stored fields (`storeFields: []`).
12
+ - **String query normalization** — pre-allocated term/spec buffers, hoisted per-query field boosts and match weights, and shared `termToQuerySpec` building (fewer intermediate arrays and closures).
13
+
14
+ ## v1.2.0 — `@yoch/frozenminisearch`
15
+
16
+ Minor release: configurable MSv5 snapshot compression and Node 20 support.
17
+
18
+ ### Added
19
+
20
+ - **`SaveBinaryOptions`** — `saveBinarySync()` / `saveBinaryAsync()` accept `{ compression: 'auto' | 'raw' | 'zstd' | 'zlib' }`.
21
+ - **`CODEC_ZLIB`** — portable deflate snapshots readable on Node 20+; explicit `compression: 'zlib'` always writes zlib on disk.
22
+ - **Exported types** — `BinaryCompression`, `SaveBinaryOptions`.
23
+
24
+ ### Improved
25
+
26
+ - **`compression: 'auto'`** — one compression pass: zstd when available (Node 22.15+), otherwise zlib on Node 20–22.14, otherwise raw when compression does not strictly shrink the payload (including payloads under 64 B).
27
+ - **Node engine** — `>=20` (was `>=22.15`); zstd remains available on Node 22.15+ and is required to read zstd snapshots.
28
+
5
29
  ## v1.1.0 — `@yoch/frozenminisearch`
6
30
 
7
31
  Minor release: MiniSearch JSON wire export and clearer JSON import API. MSv5 binary format unchanged.
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![CI](https://github.com/yoch/frozenminisearch/actions/workflows/main.yml/badge.svg)](https://github.com/yoch/frozenminisearch/actions/workflows/main.yml)
6
6
  [![Socket Badge](https://socket.dev/api/badge/npm/package/@yoch/frozenminisearch)](https://socket.dev/npm/package/%40yoch%2Ffrozenminisearch)
7
7
 
8
+ [API documentation](https://yoch.github.io/frozenminisearch/)
9
+
8
10
  **Memory-optimized, read-only full-text search for Node.js** — the same BM25, prefix/fuzzy, and `autoSuggest` API as [MiniSearch](https://github.com/lucaong/minisearch), with **up to ~98% less index RAM** on real corpora and compact binary snapshots you ship instead of JSON.
9
11
 
10
12
  **Why it exists:** [MiniSearch](https://github.com/lucaong/minisearch) optimizes for a mutable in-memory index. FrozenMiniSearch optimizes for **retained heap, disk footprint, and cold load** once the corpus is fixed — packed radix postings, columnar `storeFields`, typed-array layouts, and MSv5 binary wire format instead of per-document JS objects.
@@ -186,7 +188,23 @@ const buf = index.saveBinarySync()
186
188
  const loaded = FrozenMiniSearch.loadBinarySync(buf, {}) // field names embedded in snapshot
187
189
  ```
188
190
 
189
- - **Node ≥ 22.15.0** (zstd via `node:zlib`)
191
+ - **Node ≥ 20**
192
+ - Default snapshot compression (`compression: 'auto'`, one pass):
193
+ - payloads under 64 B stay raw
194
+ - `zstd` on Node 22.15+ when it strictly shrinks the payload
195
+ - otherwise `zlib` on Node 20–22.14 when it strictly shrinks the payload
196
+ - otherwise `raw` (uncompressed)
197
+ - Explicit snapshot compression always writes the chosen codec, even when compression would not shrink the payload (useful for portability):
198
+
199
+ ```javascript
200
+ const portable = index.saveBinarySync({ compression: 'zlib' })
201
+ const uncompressed = index.saveBinarySync({ compression: 'raw' })
202
+ const bestRatio = index.saveBinarySync({ compression: 'zstd' }) // Node 22.15+
203
+ ```
204
+
205
+ - Snapshot readability depends on the embedded codec:
206
+ - `raw` and `zlib` snapshots load on Node 20+
207
+ - `zstd` snapshots require Node 22.15+
190
208
  - Snapshots produced by this package version are forward-compatible; re-build from MiniSearch JSON if an older binary fails to load
191
209
  - `tokenize` / `processTerm` are not stored — pass the same functions at load when customized
192
210