@delali/narsil 0.3.1-next.90 → 0.3.1-next.94
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/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/browser/{chunk-3GZQKGVQ.mjs → chunk-4JTBL63P.mjs} +13 -5
- package/dist/browser/{chunk-3ZRMZIH4.mjs → chunk-5S74HQRT.mjs} +208 -78
- package/dist/browser/{chunk-FHFFWLEK.mjs → chunk-HARBSUWP.mjs} +3 -4
- package/dist/browser/{chunk-RAHUQOJL.mjs → chunk-HC6DMR4T.mjs} +2445 -2107
- package/dist/browser/{chunk-JACCR3BJ.mjs → chunk-PP6N5CCS.mjs} +2 -2
- package/dist/browser/{chunk-NQW2YXEX.mjs → chunk-WKPJ4E73.mjs} +1 -1
- package/dist/browser/{durability-wiring-VSUBLUDK.mjs → durability-wiring-7DKYHKT5.mjs} +498 -71
- package/dist/browser/{module-E25UDADM.mjs → module-O5WH32EL.mjs} +102 -54
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-Z7FZZNKH.mjs +35 -0
- package/dist/browser/{snapshot-5MXBEDXF.mjs → snapshot-PPTZ565G.mjs} +368 -103
- package/dist/browser/{write-6SBYTS62.mjs → write-2ZAA7UDH.mjs} +4 -4
- package/dist/{capabilities-SJPttcgQ.d.ts → capabilities-xsJfdFoQ.d.ts} +11 -3
- package/dist/chunk-2GZGBOQI.mjs +426 -0
- package/dist/{chunk-CVQWQVFX.mjs → chunk-4ZJWRETC.mjs} +2 -2
- package/dist/chunk-7KC56574.mjs +507 -0
- package/dist/{chunk-MXS5HWIH.mjs → chunk-7VALMHZF.mjs} +89 -17
- package/dist/chunk-7X5JST5L.mjs +114 -0
- package/dist/{chunk-UKSUENHK.mjs → chunk-AF2CIKYC.mjs} +40 -26
- package/dist/{chunk-BVOJIYRV.mjs → chunk-BB7MASRQ.mjs} +1 -1
- package/dist/{chunk-R6BMMQXH.mjs → chunk-C45FUYPI.mjs} +193 -79
- package/dist/{chunk-EMXAYPTQ.mjs → chunk-CHOGQSHK.mjs} +2326 -3503
- package/dist/{chunk-QZN3MIJ3.mjs → chunk-ES33L3HO.mjs} +2 -2
- package/dist/{chunk-VY4DXZ5P.mjs → chunk-EWBXO45L.mjs} +3 -3
- package/dist/{chunk-QAMUC2BJ.mjs → chunk-EX62BQT6.mjs} +10 -9
- package/dist/{chunk-MWJIAREY.mjs → chunk-EZD4MWOU.mjs} +4 -4
- package/dist/{chunk-YCJLVNWR.mjs → chunk-F52QGNZ2.mjs} +1 -1
- package/dist/{chunk-URGLSNKR.mjs → chunk-GJZHU4FC.mjs} +202 -16
- package/dist/{chunk-S4LQDSUL.mjs → chunk-J53IHLG7.mjs} +7 -7
- package/dist/{chunk-R7OSDAFK.mjs → chunk-K6A4FCVR.mjs} +1 -1
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-GCM3JFVA.mjs → chunk-OHP7QR33.mjs} +2 -1
- package/dist/{chunk-T6CNO72J.mjs → chunk-QM3VPX4Z.mjs} +2 -2
- package/dist/{chunk-V7YUSKKZ.mjs → chunk-QWWCLRXX.mjs} +10 -6
- package/dist/chunk-QY7GC2MW.mjs +33 -0
- package/dist/{chunk-DCK4P5BI.mjs → chunk-R36MIGBU.mjs} +100 -59
- package/dist/{chunk-YRX6XMOQ.mjs → chunk-R6PR4WYZ.mjs} +1 -0
- package/dist/{chunk-RVM7AODE.mjs → chunk-RDJKYKMQ.mjs} +2 -2
- package/dist/{chunk-OOSIDHA3.mjs → chunk-RSRVGAIQ.mjs} +1 -1
- package/dist/{chunk-XSZVS4S3.mjs → chunk-RUIXODYU.mjs} +9 -4
- package/dist/{chunk-A3UB2MXL.mjs → chunk-SBCEHIPL.mjs} +4 -507
- package/dist/{chunk-TPJU7NDJ.mjs → chunk-SYWGORQB.mjs} +1 -0
- package/dist/chunk-UAUZGXJP.mjs +3591 -0
- package/dist/{chunk-CL4OM7GB.mjs → chunk-WBS3EYC4.mjs} +12 -8
- package/dist/{chunk-J2BPXTD7.mjs → chunk-WLOF6HSP.mjs} +3 -3
- package/dist/chunk-X5CV2E2B.mjs +1 -0
- package/dist/{chunk-ULRPNYAG.mjs → chunk-Z3MOCHG5.mjs} +120 -62
- package/dist/chunk-ZHS44YKF.mjs +35 -0
- package/dist/{client-BMK53IR2.d.ts → client-CgayPw2R.d.ts} +27 -3
- package/dist/client.d.ts +9 -8
- package/dist/client.mjs +16 -2
- package/dist/{config-UJx1dyX1.d.ts → config-3kBsQ0Pi.d.ts} +2 -2
- package/dist/{config-BUR-7eVQ.d.ts → config-B-RnO6dr.d.ts} +2 -2
- package/dist/direct-executor-IJTRU3YN.mjs +22 -0
- package/dist/distribution/coordinator/etcd.d.ts +3 -2
- package/dist/distribution/coordinator/etcd.mjs +5 -1
- package/dist/distribution/coordinator/in-memory.d.ts +3 -2
- package/dist/distribution/coordinator/in-memory.mjs +4 -0
- package/dist/distribution/transport/grpc.mjs +3 -3
- package/dist/distribution/transport/in-memory.mjs +1 -1
- package/dist/distribution/transport/tcp.mjs +2 -2
- package/dist/distribution.d.ts +43 -9
- package/dist/distribution.mjs +4620 -4293
- package/dist/{durability-wiring-ZLRQU6FG.mjs → durability-wiring-Y55SCPFC.mjs} +524 -93
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/{engine-9X6W5naj.d.ts → engine-DSUfY2F0.d.ts} +53 -17
- package/dist/{index-vCMu8OeQ.d.ts → index-ONAEaqtx.d.ts} +8 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.ts +44 -25
- package/dist/index.mjs +22 -18
- package/dist/{memory-CV9NAxLY.d.ts → memory-wuXcYOD1.d.ts} +99 -79
- package/dist/{module-WIDYIJLY.mjs → module-VITS4ZR5.mjs} +72 -38
- package/dist/partial-words.mjs +5 -4
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +60 -58
- package/dist/persistence/durability/checkpoint-worker.mjs +27 -23
- package/dist/react.d.ts +8 -7
- package/dist/react.mjs +1 -0
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/restore-queue-4SG45BLF.mjs +35 -0
- package/dist/{schema-DtsgmNfU.d.ts → schema-DttzM-ln.d.ts} +12 -0
- package/dist/server.d.ts +11 -10
- package/dist/server.mjs +38 -11
- package/dist/snapshot-XBKE7PUG.mjs +738 -0
- package/dist/synonyms-CpOAHPa-.d.ts +52 -0
- package/dist/synonyms.d.ts +22 -0
- package/dist/synonyms.mjs +12 -0
- package/dist/{tasks-BGaZJyoY.d.ts → tasks-Bj9WBlFG.d.ts} +4 -1
- package/dist/{thread-ZP3UMIZT.mjs → thread-U7XYJWGG.mjs} +17 -12
- package/dist/vector/search-worker.d.ts +2 -1
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +6 -6
- package/dist/{write-PXDKPG2R.mjs → write-BMNV7P2H.mjs} +24 -20
- package/package.json +15 -7
- package/dist/chunk-PR4O7CAP.mjs +0 -18
- package/dist/chunk-X4SEXL4U.mjs +0 -2310
- package/dist/chunk-Y2F66IQJ.mjs +0 -74
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/direct-executor-EGESD26S.mjs +0 -18
- package/dist/snapshot-22CUEYYW.mjs +0 -469
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, recordCheckpoint, planCheckpoint, deserialize, assignStorePartitions, liveSize, threadsHoldCurrentLayout, filterForOptions, OSQ4_MIN_DIMENSION, emptyFieldBeforeRestore, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, releaseReplacedVectors, WORKER_COPY_MIN_VECTORS, allLiveDocIds, recalibrateFromStore, signatureOf, adoptGraph, calibrateQuantizer, fieldHandlesOf, BUILD_CHUNK_SIZE, yieldToEventLoop, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-
|
|
2
|
-
import { isDead, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors } from './chunk-
|
|
3
|
-
import { createVectorStore } from './chunk-
|
|
4
|
-
export { openSharedVectorField } from './chunk-
|
|
5
|
-
import { osqBitsOf, createOsqQuantizer, ordinalFilterValues, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, createOrdinalFilter, addToOrdinalFilter, nativeScoresOf, toScore, ordinalFilterHas, magnitude, nativeStoreScratchBytes, toDistance, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, createHNSWIndex, topLayerInParts, sharedMemoryAvailable, requireWholeNeighbourLists, releaseLocksHeldBy } from './chunk-
|
|
6
|
-
export { releaseLocksHeldBy } from './chunk-
|
|
1
|
+
import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, recordCheckpoint, planCheckpoint, deserialize, assignStorePartitions, liveSize, ordinalFilterForSubsets, threadsHoldCurrentLayout, filterForOptions, OSQ4_MIN_DIMENSION, emptyFieldBeforeRestore, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, releaseReplacedVectors, WORKER_COPY_MIN_VECTORS, allLiveDocIds, recalibrateFromStore, signatureOf, adoptGraph, calibrateQuantizer, fieldHandlesOf, BUILD_CHUNK_SIZE, yieldToEventLoop, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-7VALMHZF.mjs';
|
|
2
|
+
import { isDead, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors } from './chunk-F52QGNZ2.mjs';
|
|
3
|
+
import { createVectorStore } from './chunk-AF2CIKYC.mjs';
|
|
4
|
+
export { openSharedVectorField } from './chunk-AF2CIKYC.mjs';
|
|
5
|
+
import { osqBitsOf, createOsqQuantizer, STORE_ORDINAL_LAYOUT_GENERATION, ordinalFilterValues, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, createOrdinalFilter, addToOrdinalFilter, nativeScoresOf, toScore, ordinalFilterHas, magnitude, nativeStoreScratchBytes, toDistance, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, createHNSWIndex, topLayerInParts, sharedMemoryAvailable, requireWholeNeighbourLists, releaseLocksHeldBy } from './chunk-Z3MOCHG5.mjs';
|
|
6
|
+
export { releaseLocksHeldBy } from './chunk-Z3MOCHG5.mjs';
|
|
7
7
|
import './chunk-37CD3OKS.mjs';
|
|
8
8
|
import { noteFallback } from './chunk-DJHHF2L5.mjs';
|
|
9
9
|
import { spawnNodeWorker } from './chunk-C7SLA6CM.mjs';
|
|
10
|
-
import { resolveWorkerCount, resolveWorkerEntry, workerResourceLimits } from './chunk-
|
|
10
|
+
import { resolveWorkerCount, resolveWorkerEntry, workerResourceLimits } from './chunk-RDJKYKMQ.mjs';
|
|
11
11
|
import { detectRuntime } from './chunk-AV4IJKD2.mjs';
|
|
12
12
|
import './chunk-Q5DC6WAB.mjs';
|
|
13
|
-
import
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
13
|
+
import './chunk-KOKM4PQN.mjs';
|
|
14
|
+
import { MAX_RENUMBERED_SEARCH_ATTEMPTS, DISK_STORAGE_BLOCK_BYTES, UNPLACED_FLAG_CHUNK_ORDINALS, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_INSERT_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS } from './chunk-QY7GC2MW.mjs';
|
|
15
|
+
import './chunk-ES33L3HO.mjs';
|
|
16
16
|
import './chunk-FGMGUDHX.mjs';
|
|
17
17
|
import './chunk-KEHK2O6P.mjs';
|
|
18
18
|
import './chunk-R6A773WK.mjs';
|
|
19
19
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
20
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
20
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
21
21
|
|
|
22
22
|
// src/core/heap.ts
|
|
23
23
|
function createMaxHeap(compare) {
|
|
@@ -220,14 +220,21 @@ function scoreCandidates(store, candidates, query, k, metric, minSimilarity) {
|
|
|
220
220
|
function createSharedVectorSearcher(options) {
|
|
221
221
|
const { fieldName, view, holdsDocument } = options;
|
|
222
222
|
const flags = readStoreFlags(view.store);
|
|
223
|
-
function
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
223
|
+
function ordinalLayoutGeneration() {
|
|
224
|
+
return Atomics.load(view.store.handles.header, STORE_ORDINAL_LAYOUT_GENERATION);
|
|
225
|
+
}
|
|
226
|
+
function ordinalSpace() {
|
|
227
|
+
const store = view.store;
|
|
228
|
+
const layoutGeneration = ordinalLayoutGeneration();
|
|
229
|
+
return {
|
|
230
|
+
fieldName,
|
|
231
|
+
layoutGeneration,
|
|
232
|
+
slots: store.slots,
|
|
233
|
+
header: store.handles.header,
|
|
234
|
+
ordinalOf: (docId) => view.ordinalOf(docId),
|
|
235
|
+
holdsCurrentOrdinal: (ordinal) => store.holdsOrdinal(ordinal) && store.partitionAt(ordinal) !== void 0,
|
|
236
|
+
isRemoved: (ordinal) => flags.isRemoved(ordinal)
|
|
237
|
+
};
|
|
231
238
|
}
|
|
232
239
|
function filterForPartitions(allowed) {
|
|
233
240
|
const slots = view.store.slots;
|
|
@@ -241,7 +248,9 @@ function createSharedVectorSearcher(options) {
|
|
|
241
248
|
return filter;
|
|
242
249
|
}
|
|
243
250
|
function filterFor(searchOptions) {
|
|
244
|
-
if (searchOptions.
|
|
251
|
+
if (searchOptions.filterSubsets !== void 0) {
|
|
252
|
+
return ordinalFilterForSubsets(searchOptions.filterSubsets, ordinalSpace());
|
|
253
|
+
}
|
|
245
254
|
if (searchOptions.filterPartitions !== void 0) return filterForPartitions(searchOptions.filterPartitions);
|
|
246
255
|
return void 0;
|
|
247
256
|
}
|
|
@@ -257,6 +266,11 @@ function createSharedVectorSearcher(options) {
|
|
|
257
266
|
}
|
|
258
267
|
return candidates;
|
|
259
268
|
}
|
|
269
|
+
function answerOf(outcome) {
|
|
270
|
+
const results = outcome.results.filter((result) => holdsDocument(result.docId));
|
|
271
|
+
const holdsEveryHit = outcome.resolvedEveryHit && results.length === outcome.results.length;
|
|
272
|
+
return { results, matched: outcome.matched, matchedExact: outcome.matchedExact && holdsEveryHit };
|
|
273
|
+
}
|
|
260
274
|
function scanned(scan) {
|
|
261
275
|
return { results: scan.results, matched: scan.matched, matchedExact: true, resolvedEveryHit: true };
|
|
262
276
|
}
|
|
@@ -315,21 +329,25 @@ function createSharedVectorSearcher(options) {
|
|
|
315
329
|
{ expected: view.handles.dimension, received: query.length }
|
|
316
330
|
);
|
|
317
331
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
332
|
+
for (let attempt = 1; ; attempt++) {
|
|
333
|
+
const layoutGeneration = ordinalLayoutGeneration();
|
|
334
|
+
const outcome = search2(query, k, searchOptions, filterFor(searchOptions));
|
|
335
|
+
if (view.graphRetired) {
|
|
336
|
+
throw new NarsilError(
|
|
337
|
+
ErrorCodes.WORKER_BUSY,
|
|
338
|
+
`The main thread replaced the graph of vector field "${fieldName}" while this thread searched it`,
|
|
339
|
+
{ fieldName }
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
if (ordinalLayoutGeneration() === layoutGeneration) return Promise.resolve(answerOf(outcome));
|
|
343
|
+
if (attempt >= MAX_RENUMBERED_SEARCH_ATTEMPTS) {
|
|
344
|
+
throw new NarsilError(
|
|
345
|
+
ErrorCodes.WORKER_BUSY,
|
|
346
|
+
`The main thread renumbered the vectors of field "${fieldName}" during each of ${attempt} searches on this thread`,
|
|
347
|
+
{ fieldName, attempts: attempt }
|
|
348
|
+
);
|
|
349
|
+
}
|
|
325
350
|
}
|
|
326
|
-
const results = outcome.results.filter((result) => holdsDocument(result.docId));
|
|
327
|
-
const holdsEveryHit = outcome.resolvedEveryHit && results.length === outcome.results.length;
|
|
328
|
-
return Promise.resolve({
|
|
329
|
-
results,
|
|
330
|
-
matched: outcome.matched,
|
|
331
|
-
matchedExact: outcome.matchedExact && holdsEveryHit
|
|
332
|
-
});
|
|
333
351
|
}
|
|
334
352
|
};
|
|
335
353
|
}
|
|
@@ -659,6 +677,11 @@ async function withdrawWorkerCopies(state) {
|
|
|
659
677
|
await Promise.all([...handles].map((handle) => dropHandle(state, handle)));
|
|
660
678
|
if (state.workerCopies.host === void 0 && state.sharedHandles.size === 0) state.workerCopyPool = null;
|
|
661
679
|
}
|
|
680
|
+
async function holdWorkerCopies(state) {
|
|
681
|
+
state.workerCopiesHeld = true;
|
|
682
|
+
await state.sharing;
|
|
683
|
+
await withdrawWorkerCopies(state);
|
|
684
|
+
}
|
|
662
685
|
function noteWrite(state) {
|
|
663
686
|
state.revision += 1;
|
|
664
687
|
if (state.workerCopyMode === "clone") invalidateWorkerCopies(state);
|
|
@@ -757,7 +780,7 @@ async function loadOnPool(state, graph, searchable) {
|
|
|
757
780
|
}
|
|
758
781
|
function shareGraph(state, graph, searchable) {
|
|
759
782
|
const run = state.sharing.then(async () => {
|
|
760
|
-
if (!state.workerCopies.enabled || state.disposed) return null;
|
|
783
|
+
if (!state.workerCopies.enabled || state.disposed || state.workerCopiesHeld) return null;
|
|
761
784
|
const existing = state.sharedHandles.get(graph);
|
|
762
785
|
const layoutUnchanged = threadsHoldCurrentLayout(state);
|
|
763
786
|
if (existing !== void 0 && layoutUnchanged && (existing.searchable || !searchable)) return existing.handle;
|
|
@@ -772,7 +795,7 @@ function shareGraph(state, graph, searchable) {
|
|
|
772
795
|
}
|
|
773
796
|
function resendSharedHandles(state) {
|
|
774
797
|
const run = state.sharing.then(async () => {
|
|
775
|
-
if (!state.workerCopies.enabled || state.disposed) return;
|
|
798
|
+
if (!state.workerCopies.enabled || state.disposed || state.workerCopiesHeld) return;
|
|
776
799
|
const host = state.workerCopies.host;
|
|
777
800
|
for (const [graph, shared] of [...state.sharedHandles]) {
|
|
778
801
|
if (host !== void 0) await loadOnHost(state, host, graph, shared.searchable);
|
|
@@ -786,7 +809,7 @@ function resendSharedHandles(state) {
|
|
|
786
809
|
return run;
|
|
787
810
|
}
|
|
788
811
|
function scheduleWorkerCopyLoad(state) {
|
|
789
|
-
if (!state.workerCopies.enabled) return;
|
|
812
|
+
if (!state.workerCopies.enabled || state.workerCopiesHeld) return;
|
|
790
813
|
if (state.disposed || state.workerCopyLoading || state.building) return;
|
|
791
814
|
const graph = state.hnsw;
|
|
792
815
|
const host = state.workerCopies.host;
|
|
@@ -1634,6 +1657,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
1634
1657
|
workerCopyRevision: -1,
|
|
1635
1658
|
workerCopyMode: null,
|
|
1636
1659
|
workerCopyLoading: false,
|
|
1660
|
+
workerCopiesHeld: false,
|
|
1637
1661
|
sharedHandles: /* @__PURE__ */ new Map(),
|
|
1638
1662
|
sharedLayoutRevision: 0,
|
|
1639
1663
|
sharing: Promise.resolve(),
|
|
@@ -1731,7 +1755,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
1731
1755
|
releaseHeldMemory();
|
|
1732
1756
|
}
|
|
1733
1757
|
async function searchParallel(query, k, options) {
|
|
1734
|
-
const confined = options.
|
|
1758
|
+
const confined = options.filterSubsets !== void 0 || options.filterPartitions !== void 0;
|
|
1735
1759
|
let filter = filterForOptions(state, options);
|
|
1736
1760
|
if (filter !== void 0) {
|
|
1737
1761
|
if (state.hnsw) {
|
|
@@ -1812,6 +1836,16 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
1812
1836
|
releaseVectorFiles: async () => {
|
|
1813
1837
|
await withdrawWorkerCopies(state);
|
|
1814
1838
|
state.store.closeFiles();
|
|
1839
|
+
},
|
|
1840
|
+
relocateVectorFiles: (rewrite) => {
|
|
1841
|
+
state.store.relocateVectorFiles(rewrite);
|
|
1842
|
+
for (const [docId, location] of state.pendingLocations) {
|
|
1843
|
+
state.pendingLocations.set(docId, { ...location, path: rewrite(location.path) });
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
holdWorkerCopies: () => holdWorkerCopies(state),
|
|
1847
|
+
resumeWorkerCopies: () => {
|
|
1848
|
+
state.workerCopiesHeld = false;
|
|
1815
1849
|
}
|
|
1816
1850
|
};
|
|
1817
1851
|
}
|
package/dist/partial-words.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { partialWordSearchModule } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { partialWordSearchModule } from './chunk-SBCEHIPL.mjs';
|
|
2
|
+
import './chunk-4ZJWRETC.mjs';
|
|
3
3
|
import './chunk-FGMGUDHX.mjs';
|
|
4
4
|
import './chunk-KEHK2O6P.mjs';
|
|
5
5
|
import './chunk-GES7U2PM.mjs';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-BB7MASRQ.mjs';
|
|
7
|
+
import './chunk-7KC56574.mjs';
|
|
7
8
|
import './chunk-R6A773WK.mjs';
|
|
8
9
|
import './chunk-YTJCGKM4.mjs';
|
|
9
10
|
import './chunk-L5ORED7V.mjs';
|
|
10
|
-
import './chunk-
|
|
11
|
+
import './chunk-SYWGORQB.mjs';
|
|
11
12
|
|
|
12
13
|
// src/partial-words/index.ts
|
|
13
14
|
var partialWordSearch = partialWordSearchModule;
|
package/dist/pattern.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { patternSearchModule } from './chunk-
|
|
1
|
+
import { patternSearchModule } from './chunk-QM3VPX4Z.mjs';
|
|
2
2
|
import './chunk-WQBCBKY3.mjs';
|
|
3
3
|
import './chunk-GES7U2PM.mjs';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-BB7MASRQ.mjs';
|
|
5
5
|
import './chunk-YTJCGKM4.mjs';
|
|
6
6
|
import './chunk-L5ORED7V.mjs';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-SYWGORQB.mjs';
|
|
8
8
|
|
|
9
9
|
// src/pattern/index.ts
|
|
10
10
|
var patternSearch = patternSearchModule;
|
|
@@ -1,56 +1,14 @@
|
|
|
1
|
-
import { P as PartitionConfig, b as ScoringMode, V as VectorIndexConfig } from '../../schema-
|
|
1
|
+
import { P as PartitionConfig, b as ScoringMode, V as VectorIndexConfig } from '../../schema-DttzM-ln.js';
|
|
2
2
|
import '../../adapters-79OIa4xm.js';
|
|
3
|
+
import '../../synonyms-CpOAHPa-.js';
|
|
3
4
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** The partitions this copy holds, which a cluster node answers a partition-stores request from. */
|
|
11
|
-
heldPartitions?: number[];
|
|
12
|
-
schema: Record<string, string>;
|
|
13
|
-
language: string;
|
|
14
|
-
partitionCount: number;
|
|
15
|
-
bm25Params: {
|
|
16
|
-
k1: number;
|
|
17
|
-
b: number;
|
|
18
|
-
};
|
|
19
|
-
createdAt: number;
|
|
20
|
-
engineVersion: string;
|
|
21
|
-
vectorFields?: Record<string, {
|
|
22
|
-
dimension: number;
|
|
23
|
-
metric: string;
|
|
24
|
-
quantization: string;
|
|
25
|
-
}>;
|
|
26
|
-
embedding?: IndexEmbeddingMetadata;
|
|
27
|
-
/** Persisted so recovered indexes keep collecting surface forms. */
|
|
28
|
-
surfaceForms?: boolean;
|
|
29
|
-
analysisRevision?: string;
|
|
30
|
-
tokenizer?: string;
|
|
31
|
-
stopWords?: string;
|
|
32
|
-
stopWordList?: string[];
|
|
33
|
-
partitionLimits?: PartitionConfig;
|
|
34
|
-
defaultScoring?: ScoringMode;
|
|
35
|
-
trackPositions?: boolean;
|
|
36
|
-
strict?: boolean;
|
|
37
|
-
required?: string[];
|
|
38
|
-
vectorPromotion?: VectorIndexConfig;
|
|
39
|
-
patternValueLimit?: number;
|
|
40
|
-
}
|
|
41
|
-
/** Persisted so recovery can restore field mappings and rebind the adapter by
|
|
42
|
-
* name; the name is absent when the index was configured with a bare instance. */
|
|
43
|
-
interface IndexEmbeddingMetadata {
|
|
44
|
-
adapter?: string;
|
|
45
|
-
fields: Record<string, string | string[]>;
|
|
5
|
+
interface PatternIndexArrays {
|
|
6
|
+
fieldPath: string;
|
|
7
|
+
docIds: Uint32Array;
|
|
8
|
+
runs: Uint32Array;
|
|
9
|
+
offsets: Uint32Array;
|
|
10
|
+
postings: Uint32Array;
|
|
46
11
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Persisted surface-form dictionary of one partition. Keys are the
|
|
49
|
-
* unstemmed display tokens; the value is the occurrence count when the
|
|
50
|
-
* surface equals its index token, or `[count, indexToken]` when stemming
|
|
51
|
-
* changed it.
|
|
52
|
-
*/
|
|
53
|
-
type SerializedSurfaceForms = Record<string, number | [number, string]>;
|
|
54
12
|
|
|
55
13
|
interface FrozenTokenTableData {
|
|
56
14
|
blob: Uint8Array;
|
|
@@ -59,14 +17,6 @@ interface FrozenTokenTableData {
|
|
|
59
17
|
documentFrequencies: Uint32Array;
|
|
60
18
|
}
|
|
61
19
|
|
|
62
|
-
interface PatternIndexArrays {
|
|
63
|
-
fieldPath: string;
|
|
64
|
-
docIds: Uint32Array;
|
|
65
|
-
runs: Uint32Array;
|
|
66
|
-
offsets: Uint32Array;
|
|
67
|
-
postings: Uint32Array;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
20
|
interface PartialSpellings {
|
|
71
21
|
fields: string[];
|
|
72
22
|
tokens: string[];
|
|
@@ -205,6 +155,58 @@ interface PartitionManifestEntry {
|
|
|
205
155
|
segments: SegmentRef[];
|
|
206
156
|
}
|
|
207
157
|
|
|
158
|
+
interface IndexMetadata {
|
|
159
|
+
indexName: string;
|
|
160
|
+
/** Number of documents represented by the last completed checkpoint. */
|
|
161
|
+
documentCount?: number;
|
|
162
|
+
/** The identity a cluster gave the index at creation; absent on a single engine. */
|
|
163
|
+
indexUuid?: string;
|
|
164
|
+
/** The partitions this copy holds, which a cluster node answers a partition-stores request from. */
|
|
165
|
+
heldPartitions?: number[];
|
|
166
|
+
schema: Record<string, string>;
|
|
167
|
+
language: string;
|
|
168
|
+
partitionCount: number;
|
|
169
|
+
bm25Params: {
|
|
170
|
+
k1: number;
|
|
171
|
+
b: number;
|
|
172
|
+
};
|
|
173
|
+
createdAt: number;
|
|
174
|
+
engineVersion: string;
|
|
175
|
+
vectorFields?: Record<string, {
|
|
176
|
+
dimension: number;
|
|
177
|
+
metric: string;
|
|
178
|
+
quantization: string;
|
|
179
|
+
}>;
|
|
180
|
+
embedding?: IndexEmbeddingMetadata;
|
|
181
|
+
/** Persisted so recovered indexes keep collecting surface forms. */
|
|
182
|
+
surfaceForms?: boolean;
|
|
183
|
+
analysisRevision?: string;
|
|
184
|
+
tokenizer?: string;
|
|
185
|
+
stopWords?: string;
|
|
186
|
+
stopWordList?: string[];
|
|
187
|
+
partitionLimits?: PartitionConfig;
|
|
188
|
+
defaultScoring?: ScoringMode;
|
|
189
|
+
trackPositions?: boolean;
|
|
190
|
+
strict?: boolean;
|
|
191
|
+
required?: string[];
|
|
192
|
+
vectorPromotion?: VectorIndexConfig;
|
|
193
|
+
patternValueLimit?: number;
|
|
194
|
+
synonyms?: unknown;
|
|
195
|
+
}
|
|
196
|
+
/** Persisted so recovery can restore field mappings and rebind the adapter by
|
|
197
|
+
* name; the name is absent when the index was configured with a bare instance. */
|
|
198
|
+
interface IndexEmbeddingMetadata {
|
|
199
|
+
adapter?: string;
|
|
200
|
+
fields: Record<string, string | string[]>;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Persisted surface-form dictionary of one partition. Keys are the
|
|
204
|
+
* unstemmed display tokens; the value is the occurrence count when the
|
|
205
|
+
* surface equals its index token, or `[count, indexToken]` when stemming
|
|
206
|
+
* changed it.
|
|
207
|
+
*/
|
|
208
|
+
type SerializedSurfaceForms = Record<string, number | [number, string]>;
|
|
209
|
+
|
|
208
210
|
interface CapturedSegment {
|
|
209
211
|
snapshot: SharedSegmentSnapshot;
|
|
210
212
|
keep: Uint8Array;
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { createDurableDirectory } from '../../chunk-
|
|
2
|
-
import { CHECKPOINT_WORKER_HEARTBEAT_MS, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-QAMUC2BJ.mjs';
|
|
3
|
-
import '../../chunk-MWJIAREY.mjs';
|
|
4
|
-
import '../../chunk-GCM3JFVA.mjs';
|
|
5
|
-
import '../../chunk-P36MUFEJ.mjs';
|
|
1
|
+
import { createDurableDirectory } from '../../chunk-EWBXO45L.mjs';
|
|
6
2
|
import '../../chunk-C7SLA6CM.mjs';
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import '../../chunk-
|
|
11
|
-
import '../../chunk-
|
|
12
|
-
import '../../chunk-
|
|
13
|
-
import '../../chunk-
|
|
3
|
+
import { CHECKPOINT_WORKER_HEARTBEAT_MS, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-EX62BQT6.mjs';
|
|
4
|
+
import '../../chunk-EZD4MWOU.mjs';
|
|
5
|
+
import '../../chunk-OHP7QR33.mjs';
|
|
6
|
+
import '../../chunk-P36MUFEJ.mjs';
|
|
7
|
+
import '../../chunk-C45FUYPI.mjs';
|
|
8
|
+
import '../../chunk-R36MIGBU.mjs';
|
|
9
|
+
import '../../chunk-RDJKYKMQ.mjs';
|
|
10
|
+
import '../../chunk-UAUZGXJP.mjs';
|
|
11
|
+
import '../../chunk-CHOGQSHK.mjs';
|
|
12
|
+
import '../../chunk-WLOF6HSP.mjs';
|
|
14
13
|
import '../../chunk-AV4IJKD2.mjs';
|
|
15
14
|
import '../../chunk-Q5DC6WAB.mjs';
|
|
15
|
+
import '../../chunk-ZHS44YKF.mjs';
|
|
16
16
|
import '../../chunk-TGP5M5R7.mjs';
|
|
17
|
-
import '../../chunk-
|
|
18
|
-
import '../../chunk-
|
|
19
|
-
import '../../chunk-
|
|
20
|
-
import '../../chunk-
|
|
17
|
+
import '../../chunk-U2BKYEC7.mjs';
|
|
18
|
+
import '../../chunk-KOKM4PQN.mjs';
|
|
19
|
+
import '../../chunk-QY7GC2MW.mjs';
|
|
20
|
+
import '../../chunk-ES33L3HO.mjs';
|
|
21
|
+
import '../../chunk-QM3VPX4Z.mjs';
|
|
21
22
|
import '../../chunk-WQBCBKY3.mjs';
|
|
22
|
-
import '../../chunk-
|
|
23
|
-
import '../../chunk-
|
|
23
|
+
import '../../chunk-SBCEHIPL.mjs';
|
|
24
|
+
import '../../chunk-4ZJWRETC.mjs';
|
|
24
25
|
import '../../chunk-FGMGUDHX.mjs';
|
|
25
26
|
import '../../chunk-KEHK2O6P.mjs';
|
|
26
27
|
import '../../chunk-GES7U2PM.mjs';
|
|
27
|
-
import '../../chunk-
|
|
28
|
-
import '../../chunk-
|
|
28
|
+
import '../../chunk-BB7MASRQ.mjs';
|
|
29
|
+
import '../../chunk-2GZGBOQI.mjs';
|
|
30
|
+
import '../../chunk-X5CV2E2B.mjs';
|
|
31
|
+
import '../../chunk-7X5JST5L.mjs';
|
|
32
|
+
import '../../chunk-7KC56574.mjs';
|
|
29
33
|
import '../../chunk-R6A773WK.mjs';
|
|
30
34
|
import '../../chunk-YTJCGKM4.mjs';
|
|
31
|
-
import '../../chunk-
|
|
32
|
-
import '../../chunk-
|
|
35
|
+
import '../../chunk-R6PR4WYZ.mjs';
|
|
36
|
+
import '../../chunk-K6A4FCVR.mjs';
|
|
33
37
|
import '../../chunk-L5ORED7V.mjs';
|
|
34
|
-
import '../../chunk-
|
|
38
|
+
import '../../chunk-SYWGORQB.mjs';
|
|
35
39
|
|
|
36
40
|
// src/persistence/durability/rebuild.ts
|
|
37
41
|
async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, prior, capturedPartitions = []) {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { N as NarsilError, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, Q as QueryParams, j as PreflightResult, e as QueryResult, k as SuggestParams, l as SuggestResult } from './memory-
|
|
2
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-
|
|
3
|
-
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-
|
|
4
|
-
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-
|
|
1
|
+
import { N as NarsilError, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, Q as QueryParams, j as PreflightResult, e as QueryResult, k as SuggestParams, l as SuggestResult } from './memory-wuXcYOD1.js';
|
|
2
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-wuXcYOD1.js';
|
|
3
|
+
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-Bj9WBlFG.js';
|
|
4
|
+
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-Bj9WBlFG.js';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
|
-
import { N as Narsil } from './engine-
|
|
7
|
-
import { N as NarsilClient, I as ImportSource } from './client-
|
|
8
|
-
import { A as AnyDocument } from './schema-
|
|
6
|
+
import { N as Narsil } from './engine-DSUfY2F0.js';
|
|
7
|
+
import { N as NarsilClient, I as ImportSource } from './client-CgayPw2R.js';
|
|
8
|
+
import { A as AnyDocument } from './schema-DttzM-ln.js';
|
|
9
|
+
import './synonyms-CpOAHPa-.js';
|
|
9
10
|
import './adapters-79OIa4xm.js';
|
|
10
11
|
|
|
11
12
|
/**
|
package/dist/react.mjs
CHANGED
|
@@ -38,6 +38,7 @@ var ErrorCodes = {
|
|
|
38
38
|
ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
|
|
39
39
|
ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
|
|
40
40
|
PARTITION_CAPACITY_EXCEEDED: "PARTITION_CAPACITY_EXCEEDED",
|
|
41
|
+
RESTORE_MEMORY_EXCEEDED: "RESTORE_MEMORY_EXCEEDED",
|
|
41
42
|
EMBEDDING_FAILED: "EMBEDDING_FAILED",
|
|
42
43
|
EMBEDDING_DIMENSION_MISMATCH: "EMBEDDING_DIMENSION_MISMATCH",
|
|
43
44
|
EMBEDDING_NO_SOURCE: "EMBEDDING_NO_SOURCE",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/engine/orchestration/release.ts
|
|
2
|
+
async function releaseIndexCopies(state, indexName, steps) {
|
|
3
|
+
const wasScaledOut = state.scaledOutIndexes.delete(indexName);
|
|
4
|
+
const loading = state.copyTransitions.get(indexName);
|
|
5
|
+
if (loading !== void 0) await loading.done.catch(() => void 0);
|
|
6
|
+
await steps.awaitReplicationIdle(state, indexName);
|
|
7
|
+
steps.cancelIdleMerge(state, indexName);
|
|
8
|
+
const reloads = wasScaledOut || loading !== void 0 && loading.kind !== "drop";
|
|
9
|
+
const pool = state.workerPool;
|
|
10
|
+
if (pool === null) return reloads;
|
|
11
|
+
pool.removeIndex(indexName);
|
|
12
|
+
state.segmentLedger.delete(indexName);
|
|
13
|
+
state.unbroadcastSegments.delete(indexName);
|
|
14
|
+
await Promise.all(
|
|
15
|
+
pool.executorEntries().map(
|
|
16
|
+
({ executor }) => executor.execute({ type: "dropIndex", indexName, requestId: `restore-release-${indexName}` }).catch((error) => {
|
|
17
|
+
if (!steps.heldNowhere(error)) throw error;
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
return reloads;
|
|
22
|
+
}
|
|
23
|
+
async function endCopyRelease(state, indexName, reloads, steps) {
|
|
24
|
+
const hold = state.copyReleaseHolds.get(indexName);
|
|
25
|
+
if (hold === void 0) return steps.resyncIndex(indexName, reloads);
|
|
26
|
+
hold.holders -= 1;
|
|
27
|
+
hold.reloads ||= reloads;
|
|
28
|
+
if (hold.holders > 0) return;
|
|
29
|
+
state.copyReleaseHolds.delete(indexName);
|
|
30
|
+
await steps.resyncIndex(indexName, hold.reloads);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { endCopyRelease, releaseIndexCopies };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/engine/index-state/replace.ts
|
|
2
|
+
function runReplacement(context, entry, body, settle) {
|
|
3
|
+
const previous = entry.state;
|
|
4
|
+
entry.state = "replacing";
|
|
5
|
+
const run = (async () => {
|
|
6
|
+
await context.waitForDrain(entry);
|
|
7
|
+
await body();
|
|
8
|
+
})().then(
|
|
9
|
+
() => settle(true, previous),
|
|
10
|
+
(error) => {
|
|
11
|
+
settle(false, previous);
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
).finally(() => {
|
|
15
|
+
entry.replacePromise = null;
|
|
16
|
+
});
|
|
17
|
+
entry.replacePromise = run;
|
|
18
|
+
return run;
|
|
19
|
+
}
|
|
20
|
+
function replaceUnregistered(context, indexName, entry, action) {
|
|
21
|
+
return runReplacement(context, entry, action, (succeeded) => {
|
|
22
|
+
if (!succeeded) {
|
|
23
|
+
context.forget(indexName);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
entry.state = "open";
|
|
27
|
+
entry.lastAccessAt = Date.now();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function replaceExclusively(context, indexName, action) {
|
|
31
|
+
let entry = context.entryOf(indexName);
|
|
32
|
+
while (true) {
|
|
33
|
+
const pending = entry.dropPromise ?? entry.replacePromise ?? entry.reopenPromise ?? entry.closePromise;
|
|
34
|
+
if (pending === null) break;
|
|
35
|
+
await pending.catch(() => void 0);
|
|
36
|
+
entry = context.entryOf(indexName);
|
|
37
|
+
}
|
|
38
|
+
const wasOpen = entry.state === "open";
|
|
39
|
+
await runReplacement(
|
|
40
|
+
context,
|
|
41
|
+
entry,
|
|
42
|
+
() => action(wasOpen),
|
|
43
|
+
(succeeded, previous) => {
|
|
44
|
+
if (!succeeded) {
|
|
45
|
+
entry.state = previous;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
entry.state = "open";
|
|
49
|
+
entry.cachedError = null;
|
|
50
|
+
entry.reopenFailures = 0;
|
|
51
|
+
entry.nextReopenAt = 0;
|
|
52
|
+
entry.lastAccessAt = Date.now();
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { replaceExclusively, replaceUnregistered };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/narsil/restore-queue.ts
|
|
2
|
+
function restoreDepsOf(core, host) {
|
|
3
|
+
return {
|
|
4
|
+
...host,
|
|
5
|
+
executor: core.executor,
|
|
6
|
+
indexRegistry: core.indexRegistry,
|
|
7
|
+
durability: core.durability,
|
|
8
|
+
filesystemDurability: core.filesystemDurability,
|
|
9
|
+
embeddingAdapters: core.embeddingAdapters,
|
|
10
|
+
markAnalysisStale: core.analysisRebuild.markStale,
|
|
11
|
+
clearAnalysisStale: core.analysisRebuild.clearStale,
|
|
12
|
+
abandonAnalysisRebuild: core.analysisRebuild.abandon,
|
|
13
|
+
indexState: core.indexState,
|
|
14
|
+
copies: core.orchestrator,
|
|
15
|
+
forgetWatermark: core.watermarkNotifier.forget
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function queueRestore(core, host, restoresInFlight, indexName, data) {
|
|
19
|
+
const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
|
|
20
|
+
const restored = previous.then(async () => {
|
|
21
|
+
const { restoreFromSnapshot } = await import('./snapshot-XBKE7PUG.mjs');
|
|
22
|
+
await restoreFromSnapshot(indexName, data, restoreDepsOf(core, host));
|
|
23
|
+
});
|
|
24
|
+
const settled = restored.then(
|
|
25
|
+
() => void 0,
|
|
26
|
+
() => void 0
|
|
27
|
+
);
|
|
28
|
+
restoresInFlight.set(indexName, settled);
|
|
29
|
+
void settled.then(() => {
|
|
30
|
+
if (restoresInFlight.get(indexName) === settled) restoresInFlight.delete(indexName);
|
|
31
|
+
});
|
|
32
|
+
return restored;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { queueRestore };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
|
|
2
|
+
import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A document as the engine stores it: any set of fields, with an optional `id`.
|
|
@@ -231,6 +232,17 @@ interface IndexConfig {
|
|
|
231
232
|
* `CONFIG_INVALID`.
|
|
232
233
|
*/
|
|
233
234
|
patternValueLimit?: number;
|
|
235
|
+
/**
|
|
236
|
+
* A search for any word in a rule of this set also matches the synonyms
|
|
237
|
+
* that the rule gives that word, and a document that holds a synonym scores
|
|
238
|
+
* as though it held the word itself. The engine analyses each word with the
|
|
239
|
+
* index's language, tokeniser, and stop words, so a word must analyse to
|
|
240
|
+
* exactly one token. {@link Narsil.createIndex} throws `CONFIG_INVALID` for
|
|
241
|
+
* a stop word, a phrase, a word that holds a control character, or a set
|
|
242
|
+
* beyond 100,000 rules, 500,000 words, or 4,194,304 bytes of words in UTF-8.
|
|
243
|
+
* {@link SynonymOperations.updateSynonyms} replaces the set without a rebuild.
|
|
244
|
+
*/
|
|
245
|
+
synonyms?: SynonymRule[];
|
|
234
246
|
}
|
|
235
247
|
/**
|
|
236
248
|
* BM25 tuning for an index.
|
package/dist/server.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-
|
|
2
|
-
import {
|
|
3
|
-
export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY,
|
|
4
|
-
import { N as Narsil } from './engine-
|
|
5
|
-
import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-
|
|
6
|
-
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-
|
|
7
|
-
import './schema-
|
|
1
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-wuXcYOD1.js';
|
|
2
|
+
import { c as ServerOptions, N as NarsilServer } from './capabilities-xsJfdFoQ.js';
|
|
3
|
+
export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, d as RequestContext, e as RequestDenial, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, f as ServerLimits, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-xsJfdFoQ.js';
|
|
4
|
+
import { N as Narsil } from './engine-DSUfY2F0.js';
|
|
5
|
+
import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-Bj9WBlFG.js';
|
|
6
|
+
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-Bj9WBlFG.js';
|
|
7
|
+
import './schema-DttzM-ln.js';
|
|
8
8
|
import './adapters-79OIa4xm.js';
|
|
9
|
-
import './
|
|
10
|
-
import './config-
|
|
11
|
-
import './
|
|
9
|
+
import './synonyms-CpOAHPa-.js';
|
|
10
|
+
import './config-3kBsQ0Pi.js';
|
|
11
|
+
import './config-B-RnO6dr.js';
|
|
12
|
+
import './index-ONAEaqtx.js';
|
|
12
13
|
import './types-Cb9kiY5P.js';
|
|
13
14
|
|
|
14
15
|
/**
|