lucivy 3.0.4 → 3.0.6

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # lucivy 3.0.4
1
+ # lucivy 3.0.6
2
2
 
3
3
  Fast BM25 full-text search for Node.js — with substring matching, fuzzy search, regex, and highlights. Powered by Rust via napi-rs.
4
4
 
package/index.d.ts CHANGED
@@ -311,6 +311,12 @@ export declare class Index {
311
311
  * @returns Total size in bytes (a `number`; exact below 2^53).
312
312
  */
313
313
  indexBytes(): number
314
+ /**
315
+ * True when the last search hit the per-segment match cap
316
+ * (`LUCIVY_MAX_MATCHES_PER_SEGMENT`, `0` disables it) on some segment:
317
+ * the hits are real, but some documents were never looked at.
318
+ */
319
+ lastSearchTruncated(): boolean
314
320
  /**
315
321
  * Delete the whole index: commit and release everything (like `close()`),
316
322
  * then remove the index files from disk.
@@ -378,9 +384,12 @@ export declare class Index {
378
384
  * from all nodes (obtained by merging `exportStats()` outputs).
379
385
  * @param limit - Maximum number of results (default 10).
380
386
  * @param highlights - If true, return highlight byte offsets per field.
387
+ * @param allowedIds - Restrict the search to those `_node_id` values: a
388
+ * real pre-filter, under the federation's statistics — the ids decide
389
+ * which documents are visited, the statistics how they score.
381
390
  * @returns `Array<SearchResult>` scored with global BM25 statistics.
382
391
  */
383
- searchWithGlobalStats(queryJson: string, globalStatsJson: string, limit?: number | undefined | null, highlights?: boolean | undefined | null): Array<SearchResult>
392
+ searchWithGlobalStats(queryJson: string, globalStatsJson: string, limit?: number | undefined | null, highlights?: boolean | undefined | null, allowedIds?: Array<number> | undefined | null): Array<SearchResult>
384
393
  }
385
394
  /**
386
395
  * An index whose files live in a storage you provide — a transactional
package/index.js CHANGED
@@ -1,3 +1,44 @@
1
- const { Index, BlobIndex, mergeStats } = require('./lucivy.node');
1
+ // The addon for this platform, in this order: the one the release workflow
2
+ // built (lucivy.<platform>.node next to this file), the platform package
3
+ // npm installed (lucivy-linux-x64-gnu, lucivy-darwin-arm64, ...), or a
4
+ // local build (`npm run build` leaves lucivy.node here).
5
+ const { platform, arch } = process;
6
+
7
+ function platformKey() {
8
+ if (platform === 'linux') return `linux-${arch}-gnu`;
9
+ if (platform === 'darwin') return `darwin-${arch}`;
10
+ if (platform === 'win32') return `win32-${arch}-msvc`;
11
+ return `${platform}-${arch}`;
12
+ }
13
+
14
+ function load() {
15
+ const key = platformKey();
16
+ // The Windows package is `lucivy-windows-x64`: npm's spam filter refused
17
+ // the napi-style `lucivy-win32-x64-msvc` at first publish.
18
+ const pkg = key === 'win32-x64-msvc' ? 'lucivy-windows-x64' : `lucivy-${key}`;
19
+ const candidates = [
20
+ `./lucivy.${key}.node`,
21
+ pkg,
22
+ `./lucivy.node`,
23
+ ];
24
+ const errors = [];
25
+ for (const candidate of candidates) {
26
+ try {
27
+ return require(candidate);
28
+ } catch (e) {
29
+ // Missing: try the next. Present but not loadable (a build for
30
+ // another platform, a broken file): say so, and try the next too.
31
+ errors.push(`${candidate}: ${String(e.message).split('\n')[0]}`);
32
+ }
33
+ }
34
+ throw new Error(
35
+ `lucivy: no addon loads on ${platform}-${arch}.\n` +
36
+ `Prebuilt: Linux x64/arm64 (glibc >= 2.28), macOS x64/arm64, Windows x64. ` +
37
+ `Elsewhere: clone https://github.com/L-Defraiteur/lucivy and run \`npm run build\` in bindings/nodejs.\n` +
38
+ errors.map(e => ' ' + e).join('\n'),
39
+ );
40
+ }
41
+
42
+ const { Index, BlobIndex, mergeStats } = load();
2
43
 
3
44
  module.exports = { Index, BlobIndex, mergeStats };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucivy",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Fast BM25 full-text search with substring matching, fuzzy search, and regex — powered by Rust",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -29,7 +29,6 @@
29
29
  "files": [
30
30
  "index.js",
31
31
  "index.d.ts",
32
- "lucivy.node",
33
32
  "README.md"
34
33
  ],
35
34
  "devDependencies": {
@@ -38,5 +37,12 @@
38
37
  "scripts": {
39
38
  "build": "napi build --release",
40
39
  "build:debug": "napi build"
40
+ },
41
+ "optionalDependencies": {
42
+ "lucivy-linux-x64-gnu": "3.0.6",
43
+ "lucivy-linux-arm64-gnu": "3.0.6",
44
+ "lucivy-darwin-x64": "3.0.6",
45
+ "lucivy-darwin-arm64": "3.0.6",
46
+ "lucivy-windows-x64": "3.0.6"
41
47
  }
42
48
  }
package/lucivy.node DELETED
Binary file