@delali/narsil 0.3.1-next.162 → 0.3.1-next.169
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 +24 -8
- package/dist/browser/{chunk-MZHQ65VI.mjs → chunk-2Q45HI5H.mjs} +14 -10
- package/dist/browser/{chunk-MMHIIL5B.mjs → chunk-4ZICWS4V.mjs} +1 -1
- package/dist/browser/{chunk-KQXKCMGQ.mjs → chunk-JHFBQKUF.mjs} +119 -90
- package/dist/browser/{core-leaf-SIWXFZLV.mjs → core-leaf-WYFANMKC.mjs} +61 -13
- package/dist/browser/custom-token-results-R5BIX7SL.mjs +59 -0
- package/dist/browser/{embed-RF2MPGAO.mjs → embed-24IPR4LP.mjs} +2 -2
- package/dist/browser/{module-PMQBRESM.mjs → module-XVLHJ7T7.mjs} +358 -62
- package/dist/browser/{optional-writes-WMZX4OEC.mjs → optional-writes-TB34FYUW.mjs} +118 -66
- package/dist/browser/{phrase-module-22TKMXWI.mjs → phrase-module-6UGFVW5J.mjs} +1 -0
- package/dist/browser/{resolve-vector-text-KI65IHMD.mjs → resolve-vector-text-EJ6DHFF5.mjs} +8 -0
- package/dist/browser/{storage-leaf-VGR2BWJJ.mjs → storage-leaf-QFXIWDFK.mjs} +208 -87
- package/dist/browser/{worker-copies-WQCPP3TS.mjs → worker-copies-ICHLYYXM.mjs} +1 -0
- package/dist/{capabilities-DkXAkb-X.d.ts → capabilities-BQIdsaWy.d.ts} +2 -2
- package/dist/{chunk-BKOMO7HT.mjs → chunk-26E5MO3Y.mjs} +5 -5
- package/dist/{chunk-EEYDJB4Z.mjs → chunk-2C3BXZGA.mjs} +213 -149
- package/dist/{chunk-NXMGUDZA.mjs → chunk-2KWTQ2P7.mjs} +2 -2
- package/dist/{chunk-TW543F33.mjs → chunk-34IOOYXA.mjs} +1 -1
- package/dist/{chunk-D5GNFN6X.mjs → chunk-7FC2ZILY.mjs} +98 -40
- package/dist/{chunk-XRBPHCCT.mjs → chunk-A4XYDUVN.mjs} +5 -5
- package/dist/{chunk-R4F7ZTVG.mjs → chunk-BIIROQ5Q.mjs} +2 -2
- package/dist/{chunk-Q2WQSAYH.mjs → chunk-CQX5B6L2.mjs} +54 -11
- package/dist/{chunk-XXWEUXE4.mjs → chunk-D6FYUTFN.mjs} +1 -1
- package/dist/{chunk-OUWZKNO3.mjs → chunk-DG6WIEB3.mjs} +1 -1
- package/dist/{chunk-GJKFXKMI.mjs → chunk-F3FDHXCJ.mjs} +12 -9
- package/dist/{chunk-3UGZBRDN.mjs → chunk-GO6TRSJ6.mjs} +1 -1
- package/dist/{react-native/chunks/chunk-OK3WUA6N.mjs → chunk-I2WJCRIH.mjs} +1 -1
- package/dist/{chunk-Q7CUUSJ2.mjs → chunk-ISJ35523.mjs} +2 -2
- package/dist/{chunk-GQLOEACG.mjs → chunk-JCWC75NH.mjs} +2 -2
- package/dist/{chunk-ZGYF37MG.mjs → chunk-JDIATDPY.mjs} +1 -1
- package/dist/{chunk-3B775F3C.mjs → chunk-JP77OWMI.mjs} +3 -1
- package/dist/{chunk-KSOZJEYU.mjs → chunk-KHJPMZE2.mjs} +1 -1
- package/dist/{chunk-ZQ6QY42L.mjs → chunk-KL6W73BZ.mjs} +8 -0
- package/dist/{chunk-ES5EOXT6.mjs → chunk-LOQHA6QK.mjs} +3 -3
- package/dist/{chunk-AB27FWZM.mjs → chunk-LPRRFCVU.mjs} +2 -2
- package/dist/{chunk-EIR3IQCL.mjs → chunk-QFJMRB7D.mjs} +2 -1
- package/dist/{chunk-S3BSDBF7.mjs → chunk-QJGDB3WR.mjs} +1 -1
- package/dist/{chunk-EI7U43MX.mjs → chunk-R7PLSVK3.mjs} +2 -2
- package/dist/{chunk-5DUTOEK5.mjs → chunk-TBOZHYCF.mjs} +2 -2
- package/dist/{chunk-VJOS6MHF.mjs → chunk-TNEU32EN.mjs} +64 -16
- package/dist/{chunk-RXMR2SIQ.mjs → chunk-UISV46WX.mjs} +4 -4
- package/dist/{chunk-4CAMH7FO.mjs → chunk-X4UMDSB4.mjs} +2 -1
- package/dist/{chunk-R4CE4IVU.mjs → chunk-X5NHWOXT.mjs} +15 -11
- package/dist/{react-native/chunks/chunk-HEELWLKL.mjs → chunk-XFOL77WH.mjs} +1 -1
- package/dist/{chunk-TOZENMM7.mjs → chunk-XITVDRRH.mjs} +5 -5
- package/dist/{chunk-FSLQHOKZ.mjs → chunk-XNFBYAXI.mjs} +1 -1
- package/dist/{chunk-V4YIEMAI.mjs → chunk-XQQKETAF.mjs} +4 -4
- package/dist/{chunk-DSXFN5BF.mjs → chunk-XTSFRWAS.mjs} +8 -8
- package/dist/{chunk-K4BMDPPX.mjs → chunk-Y27E2MGC.mjs} +2 -2
- package/dist/{chunk-JV74RKCY.mjs → chunk-YM2HI5N5.mjs} +1 -1
- package/dist/{chunk-7OE73OO4.mjs → chunk-YPV2L7M5.mjs} +56 -6
- package/dist/{chunk-STLNPJXU.mjs → chunk-YXZDTKQS.mjs} +2 -2
- package/dist/{chunk-5P72V66D.mjs → chunk-ZB5X5WAK.mjs} +24 -20
- package/dist/{client-VJmV_AjZ.d.ts → client-CeUxvIvd.d.ts} +4 -4
- package/dist/client.d.ts +8 -8
- package/dist/{config-ZZg4cwQz.d.ts → config-CIpLXXxm.d.ts} +2 -2
- package/dist/{config-Cb3FOlE_.d.ts → config-DehU-VGL.d.ts} +2 -2
- package/dist/{core-leaf-LOXCD7MY.mjs → core-leaf-VIMO377O.mjs} +3 -3
- package/dist/custom-token-results-NXHBVY7U.mjs +59 -0
- package/dist/{direct-executor-PF4UDSUW.mjs → direct-executor-2WQSGBN3.mjs} +7 -7
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution/transport/tcp.mjs +1 -1
- package/dist/distribution.d.ts +7 -7
- package/dist/distribution.mjs +39 -39
- package/dist/{embed-4H7RTBVL.mjs → embed-UNHDFGDU.mjs} +2 -2
- package/dist/{engine-DdOs682x.d.ts → engine-P-4xhUe4.d.ts} +6 -2
- package/dist/{index-Ck9w5WHz.d.ts → index-CBUl4z3E.d.ts} +1 -1
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +7 -7
- package/dist/index.react-native.mjs +6 -6
- package/dist/{long-query-thread-OTVLP2OI.mjs → long-query-thread-AAYTLYZK.mjs} +19 -19
- package/dist/{module-UIKSHY3G.mjs → module-5SXNUCD5.mjs} +315 -64
- package/dist/{msgpack-leaf-5WFRP6JM.mjs → msgpack-leaf-7KBYOVTF.mjs} +2 -2
- package/dist/{optional-reads-RSLNSGNG.mjs → optional-reads-ENKMVQ4Q.mjs} +1 -1
- package/dist/{optional-writes-4ITCV7YT.mjs → optional-writes-N2DFWWZ3.mjs} +39 -26
- package/dist/{paged-partition-archive-VMJ2AUA6.mjs → paged-partition-archive-X7L27E5Z.mjs} +19 -19
- package/dist/partial-words.browser.mjs +3 -3
- package/dist/partial-words.mjs +7 -7
- package/dist/pattern.browser.mjs +2 -2
- package/dist/pattern.mjs +2 -2
- package/dist/persistence/durability/checkpoint-worker.d.ts +1 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +17 -17
- package/dist/{phrase-module-IWSG2DDZ.mjs → phrase-module-ZY3TLTQA.mjs} +2 -1
- package/dist/{query-actions-EW72OQXY.mjs → query-actions-2JOLPELC.mjs} +7 -7
- package/dist/query-suggestions/merge-worker.mjs +10 -10
- package/dist/query-suggestions.browser.mjs +3 -3
- package/dist/query-suggestions.d.ts +2 -2
- package/dist/query-suggestions.mjs +8 -8
- package/dist/{chunk-ZBVHS5KF.mjs → react-native/chunks/chunk-57R74JWC.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-AUXXPSFB.mjs → chunk-F4MIGBBP.mjs} +214 -150
- package/dist/react-native/chunks/{chunk-3RUXKZJG.mjs → chunk-F6BJYCF2.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-RVHCQJQM.mjs → chunk-GGBATERA.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-I5W7A2JF.mjs → chunk-GVWLACAT.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-XOCM3BFU.mjs → chunk-H344ZXRH.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-VIPNDN4B.mjs → chunk-I7DTUOK2.mjs} +65 -15
- package/dist/react-native/chunks/{chunk-2JMAUU26.mjs → chunk-J2BQTJJE.mjs} +1 -1
- package/dist/{chunk-QBVTYY4J.mjs → react-native/chunks/chunk-OZ3XEM6D.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-4EXKQ2IB.mjs → chunk-SK3DPAI4.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-XBTFK3AZ.mjs → chunk-WFQ6YQZA.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-FTQ7JNMU.mjs → chunk-ZDDJVR7X.mjs} +15 -11
- package/dist/react-native/chunks/{core-leaf-O3236QY3.mjs → core-leaf-UDUMVC3M.mjs} +2 -2
- package/dist/react-native/chunks/custom-token-results-3OZEMRE7.mjs +59 -0
- package/dist/react-native/chunks/{embed-3WQ2CCR5.mjs → embed-U7CIKEY4.mjs} +2 -2
- package/dist/react-native/chunks/{module-LRR7D5ZO.mjs → module-7BJ3VOWQ.mjs} +360 -66
- package/dist/react-native/chunks/{msgpack-leaf-TR66ZVAX.mjs → msgpack-leaf-GTKLF6GJ.mjs} +2 -2
- package/dist/react-native/chunks/{optional-reads-TOWGNEDH.mjs → optional-reads-74HYI4DO.mjs} +1 -1
- package/dist/react-native/chunks/{optional-writes-7AFBIZMN.mjs → optional-writes-TXTJ6HUZ.mjs} +37 -24
- package/dist/react-native/chunks/{phrase-module-3A4AKMKL.mjs → phrase-module-UC4YGEBB.mjs} +2 -1
- package/dist/react-native/chunks/{resolve-vector-text-LXRYXF7M.mjs → resolve-vector-text-FTPD5EY6.mjs} +8 -0
- package/dist/react-native/chunks/{restore-queue-7FSHTGJ5.mjs → restore-queue-SZLWIL3B.mjs} +9 -9
- package/dist/react-native/chunks/{segment-codec-leaf-4QV4HO4R.mjs → segment-codec-leaf-WMUZ5P4F.mjs} +7 -7
- package/dist/react-native/chunks/{segment-merge-leaf-5DUZZSXJ.mjs → segment-merge-leaf-Q2OEJIQ3.mjs} +8 -8
- package/dist/react-native/chunks/{storage-leaf-PNU6HWY7.mjs → storage-leaf-OXYV6O6P.mjs} +213 -100
- package/dist/react-native/chunks/{store-leaf-ESVUGYYO.mjs → store-leaf-ZMDXYK4E.mjs} +8 -8
- package/dist/react-native/chunks/{suggestions-leaf-MOVOPBGD.mjs → suggestions-leaf-FIMGQZ2T.mjs} +8 -8
- package/dist/react-native/chunks/{worker-copies-VQGF3WZX.mjs → worker-copies-72TGFYQB.mjs} +8 -7
- package/dist/react-native/partial-words.mjs +6 -6
- package/dist/react-native/pattern.mjs +3 -3
- package/dist/react-native/query-suggestions.mjs +6 -6
- package/dist/react-native/sync.mjs +6 -6
- package/dist/react-native/synonyms.mjs +6 -6
- package/dist/react.d.ts +9 -9
- package/dist/{rerank-QHJXPSAK.mjs → rerank-E2HFKKGJ.mjs} +7 -7
- package/dist/{resolve-vector-text-4PDRTPNQ.mjs → resolve-vector-text-6WPFFIX5.mjs} +1 -1
- package/dist/{restore-queue-5W5HX44H.mjs → restore-queue-PUVBN6L3.mjs} +10 -10
- package/dist/{schema-C_7yRJLt.d.ts → schema-CzG9OUw5.d.ts} +5 -1
- package/dist/{segment-codec-leaf-7VLVXKWO.mjs → segment-codec-leaf-24Z3MMQI.mjs} +8 -8
- package/dist/{segment-merge-leaf-22XR3IGA.mjs → segment-merge-leaf-FQQDU45E.mjs} +8 -8
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +26 -26
- package/dist/{storage-leaf-ZZ77C3DX.mjs → storage-leaf-KIA7XO6Y.mjs} +79 -81
- package/dist/{store-leaf-LJ6D2PMF.mjs → store-leaf-ESVLL4JO.mjs} +9 -9
- package/dist/{suggestions-leaf-KTQHO3PY.mjs → suggestions-leaf-FXF4AHAY.mjs} +11 -11
- package/dist/sync/filesystem.d.ts +3 -3
- package/dist/sync/filesystem.mjs +15 -15
- package/dist/sync/indexeddb.browser.mjs +1 -1
- package/dist/sync/indexeddb.d.ts +3 -3
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +3 -3
- package/dist/sync.d.ts +4 -4
- package/dist/sync.mjs +7 -7
- package/dist/synonyms.browser.mjs +3 -3
- package/dist/synonyms.mjs +7 -7
- package/dist/{tasks-CxA-J_Ty.d.ts → tasks-CXtQ3Zpp.d.ts} +4 -4
- package/dist/thread-OWXVP2ZA.mjs +30 -0
- package/dist/{types-BboB278g.d.ts → types-CDN70Y_C.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +5 -5
- package/dist/{worker-copies-ODAAGQRC.mjs → worker-copies-XXX7PF4J.mjs} +10 -10
- package/dist/workers/entry.mjs +13 -13
- package/package.json +9 -8
- package/dist/thread-XWDK6TAR.mjs +0 -30
- /package/dist/{chunk-77AUVDQ5.mjs → chunk-CV3Q2EKO.mjs} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { resolveHybridFusion, reciprocalRankFusion, linearCombination, noteWaitingForMemory, admitsBackgroundBytes } from './chunk-
|
|
2
|
-
export { linearCombination, reciprocalRankFusion, resolveHybridFusion } from './chunk-
|
|
3
|
-
import { createVectorStore } from './chunk-
|
|
4
|
-
export { openSharedVectorField } from './chunk-
|
|
1
|
+
import { resolveHybridFusion, reciprocalRankFusion, linearCombination, noteWaitingForMemory, admitsBackgroundBytes } from './chunk-TBOZHYCF.mjs';
|
|
2
|
+
export { linearCombination, reciprocalRankFusion, resolveHybridFusion } from './chunk-TBOZHYCF.mjs';
|
|
3
|
+
import { createVectorStore, requireOrdinalWithinLimit } from './chunk-CQX5B6L2.mjs';
|
|
4
|
+
export { openSharedVectorField } from './chunk-CQX5B6L2.mjs';
|
|
5
5
|
export { bindVectorHost } from './chunk-T4HMSZCX.mjs';
|
|
6
|
-
import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, defaultQuantizationFor, osqBitsOf, DEFAULT_VECTOR_METRIC, noBuildHistory, createOsqQuantizer, recordCheckpoint, assignStorePartitions, liveSize, STORE_ORDINAL_LAYOUT_GENERATION, writeSequenceOf, writeSequenceWords, storePinsOf, admissionAt, handOverBuildTurns, filterForOptions, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, yieldBuildTurn, holdAdmission, fieldHandlesOf, ordinalFilterForSubsets, ordinalFilterValues, nativeScoresOf, toScore, ordinalFilterHas, threadedNativeCore, threadsHoldCurrentLayout, WORKER_COPY_MIN_VECTORS, SHUFFLED_REBUILD_MEMORY_RETRY_MS, emptyFieldBeforeRestore, nativeStoreScratchBytes, createOrdinalFilter, addToOrdinalFilter, magnitude, toDistance, SEARCH_ATTEMPTS_BEFORE_HOLDING_WRITES, recalibrateFromStore, NO_LIVE_VECTOR_AT_POSITION, signatureOf, bytesToVectors, isDead, BUILD_RETRY_MAX_DELAY_MS, BUILD_RETRY_FIRST_DELAY_MS, allLiveDocIds, sharedMemoryAvailable, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, releaseReplacedVectors, createHNSWIndex, adoptGraph, topLayerInParts, shuffleInPlace, requireWholeNeighbourLists, BUILD_STEPS_BETWEEN_CLOCK_CHECKS, createCentroidSums, liveOrdinals, RECALIBRATION_CHUNK_VECTORS, shuffleStep, SEARCH_REFILL_RESERVE, centroidOfCentroidSums, meanOfCentroidSums, countOfCentroidSums, squaredLengthsOfCentroidSums, BUILD_CHUNK_SIZE, nativeStoreFor, nativeMetricCode, withNativeThreadSlot, SEARCH_SCAN_CHUNK_VECTORS, releasePinsHeldBy, releaseLocksHeldBy, DRIFT_CHECK_GROWTH_FACTOR, adoptLoadedCalibration, planCheckpoint, deserialize, RECALIBRATION_DRIFT_RATIO, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-
|
|
7
|
-
export { holdAdmission, releaseLocksHeldBy, releasePinsHeldBy, requireUsableVectorOptions } from './chunk-
|
|
8
|
-
import { chargeHeapBytes, workerResourceLimits } from './chunk-
|
|
9
|
-
import { requirePinnedState, signalOfSearch, bindSearchSignal, createDocIdMap, resolveWorkerCount, resolveWorkerEntry, detectRuntime, spawnNodeWorker } from './chunk-
|
|
10
|
-
import { MAX_RENUMBERED_SEARCH_ATTEMPTS, DISK_STORAGE_BLOCK_BYTES, RESULT_WINDOW, turnsAreBudgeted, yieldBackgroundTurn, UNPLACED_FLAG_CHUNK_ORDINALS, holdWritesAndBackgroundWork, backgroundTurnIsSpent, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, NATIVE_THREAD_SCAN_CHUNK_ORDINALS, turnIsSpent, yieldTurn, noteThreadSlotLive, noteThreadSlotGone, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS } from './chunk-
|
|
11
|
-
import { noteFallback, NATIVE_OK } from './chunk-
|
|
6
|
+
import { VECTOR_WORKER_COPIES_ALLOWED, DEFAULT_PROMOTION_THRESHOLD, DEFAULT_FILTER_THRESHOLD, defaultQuantizationFor, osqBitsOf, DEFAULT_VECTOR_METRIC, noBuildHistory, createOsqQuantizer, recordCheckpoint, assignStorePartitions, liveSize, STORE_ORDINAL_LAYOUT_GENERATION, writeSequenceOf, writeSequenceWords, storePinsOf, admissionAt, handOverBuildTurns, filterForOptions, STORE_UNPLACED_COUNT, STORE_LIVE_COUNT, STORE_REMOVED_COUNT, ESTIMATED_MS_PER_TOMBSTONE, graphNeedsRebuild, ESTIMATED_MS_PER_VECTOR_REBUILD, yieldBuildTurn, holdAdmission, fieldHandlesOf, ordinalFilterForSubsets, ordinalFilterValues, nativeScoresOf, toScore, ordinalFilterHas, threadedNativeCore, threadsHoldCurrentLayout, WORKER_COPY_MIN_VECTORS, SHUFFLED_REBUILD_MEMORY_RETRY_MS, emptyFieldBeforeRestore, nativeStoreScratchBytes, createOrdinalFilter, addToOrdinalFilter, magnitude, toDistance, requireBytesWithinLimit, VECTOR_MEMORY_LIMITS, SEARCH_ATTEMPTS_BEFORE_HOLDING_WRITES, recalibrateFromStore, NO_LIVE_VECTOR_AT_POSITION, signatureOf, bytesToVectors, isDead, BUILD_RETRY_MAX_DELAY_MS, BUILD_RETRY_FIRST_DELAY_MS, allLiveDocIds, sharedMemoryAvailable, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, releaseReplacedVectors, createHNSWIndex, adoptGraph, topLayerInParts, shuffleInPlace, requireWholeNeighbourLists, BUILD_STEPS_BETWEEN_CLOCK_CHECKS, createCentroidSums, liveOrdinals, RECALIBRATION_CHUNK_VECTORS, shuffleStep, SEARCH_REFILL_RESERVE, centroidOfCentroidSums, meanOfCentroidSums, countOfCentroidSums, squaredLengthsOfCentroidSums, BUILD_CHUNK_SIZE, nativeStoreFor, nativeMetricCode, withNativeThreadSlot, SEARCH_SCAN_CHUNK_VECTORS, releasePinsHeldBy, releaseLocksHeldBy, DRIFT_CHECK_GROWTH_FACTOR, adoptLoadedCalibration, planCheckpoint, deserialize, RECALIBRATION_DRIFT_RATIO, DISK_ADOPTION_YIELD_INTERVAL } from './chunk-TNEU32EN.mjs';
|
|
7
|
+
export { holdAdmission, releaseLocksHeldBy, releasePinsHeldBy, requireUsableVectorOptions } from './chunk-TNEU32EN.mjs';
|
|
8
|
+
import { chargeHeapBytes, workerResourceLimits } from './chunk-LPRRFCVU.mjs';
|
|
9
|
+
import { requirePinnedState, signalOfSearch, bindSearchSignal, createDocIdMap, resolveWorkerCount, resolveWorkerEntry, detectRuntime, spawnNodeWorker } from './chunk-DG6WIEB3.mjs';
|
|
10
|
+
import { MAX_RENUMBERED_SEARCH_ATTEMPTS, DISK_STORAGE_BLOCK_BYTES, RESULT_WINDOW, turnsAreBudgeted, yieldBackgroundTurn, UNPLACED_FLAG_CHUNK_ORDINALS, holdWritesAndBackgroundWork, backgroundTurnIsSpent, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, NATIVE_THREAD_SCAN_CHUNK_ORDINALS, turnIsSpent, yieldTurn, noteThreadSlotLive, noteThreadSlotGone, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS } from './chunk-JP77OWMI.mjs';
|
|
11
|
+
import { noteFallback, NATIVE_OK } from './chunk-D6FYUTFN.mjs';
|
|
12
12
|
import './chunk-ZXX5GZEX.mjs';
|
|
13
13
|
import './chunk-4PY4JYMY.mjs';
|
|
14
14
|
import { NarsilError, ErrorCodes, isNarsilError } from './chunk-Q3ZZH5Z7.mjs';
|
|
@@ -230,6 +230,27 @@ function getVectorMaintenanceStatus(manager) {
|
|
|
230
230
|
return results;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// src/vector/query-values.ts
|
|
234
|
+
function isFloat32Representable(value) {
|
|
235
|
+
return typeof value === "number" && Number.isFinite(Math.fround(value));
|
|
236
|
+
}
|
|
237
|
+
function requireUsableQueryVector(value) {
|
|
238
|
+
if (value === void 0) return;
|
|
239
|
+
if (!Array.isArray(value) && !(value instanceof Float32Array)) {
|
|
240
|
+
throw new NarsilError(ErrorCodes.DOC_VALIDATION_FAILED, `Vector query 'value' must be an array of numbers`, {
|
|
241
|
+
received: typeof value
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
for (let index = 0; index < value.length; index++) {
|
|
245
|
+
if (isFloat32Representable(value[index])) continue;
|
|
246
|
+
throw new NarsilError(
|
|
247
|
+
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
248
|
+
`Vector query 'value' element at index ${index} is not a number that a 32-bit float holds as a finite value`,
|
|
249
|
+
{ index, value: value[index] }
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
233
254
|
// src/core/heap.ts
|
|
234
255
|
function createMaxHeap(compare) {
|
|
235
256
|
return createHeap((a, b) => compare(b, a));
|
|
@@ -2247,7 +2268,10 @@ function beginColdHold(state, field, loaded, loadWanted) {
|
|
|
2247
2268
|
written: /* @__PURE__ */ new Map(),
|
|
2248
2269
|
removedNumbers: /* @__PURE__ */ new Set(),
|
|
2249
2270
|
removedIds: /* @__PURE__ */ new Set(),
|
|
2271
|
+
removals: /* @__PURE__ */ new Map(),
|
|
2272
|
+
replacements: /* @__PURE__ */ new Map(),
|
|
2250
2273
|
writes: [],
|
|
2274
|
+
reserved: { slots: 0, docIdBytes: 0 },
|
|
2251
2275
|
live: field.liveCount
|
|
2252
2276
|
};
|
|
2253
2277
|
state.cold = hold;
|
|
@@ -2257,7 +2281,12 @@ function endColdHold(state) {
|
|
|
2257
2281
|
const hold = state.cold;
|
|
2258
2282
|
if (hold === null) return;
|
|
2259
2283
|
state.cold = null;
|
|
2260
|
-
|
|
2284
|
+
try {
|
|
2285
|
+
for (const write of hold.writes) write();
|
|
2286
|
+
} catch (error) {
|
|
2287
|
+
state.cold = hold;
|
|
2288
|
+
throw error;
|
|
2289
|
+
}
|
|
2261
2290
|
hold.field.close();
|
|
2262
2291
|
}
|
|
2263
2292
|
async function untilColdLoaded(state) {
|
|
@@ -2289,35 +2318,11 @@ function openColdField(state, field, load) {
|
|
|
2289
2318
|
(shape) => beginCheckpointRestore(state, shape),
|
|
2290
2319
|
() => state.cold === hold,
|
|
2291
2320
|
loadingWanted
|
|
2292
|
-
).then(
|
|
2293
|
-
()
|
|
2294
|
-
|
|
2295
|
-
finished();
|
|
2296
|
-
},
|
|
2297
|
-
(error) => failed(error)
|
|
2298
|
-
);
|
|
2321
|
+
).then(() => {
|
|
2322
|
+
if (state.cold === hold) endColdHold(state);
|
|
2323
|
+
}).then(finished, failed);
|
|
2299
2324
|
loaded.catch(() => void 0);
|
|
2300
2325
|
}
|
|
2301
|
-
function retireOlderCopy(hold, docId) {
|
|
2302
|
-
if (hold.written.delete(docId)) return true;
|
|
2303
|
-
if (hold.removedIds.has(docId)) return false;
|
|
2304
|
-
const number = hold.field.numberOf(docId);
|
|
2305
|
-
if (number === void 0) return false;
|
|
2306
|
-
hold.removedIds.add(docId);
|
|
2307
|
-
hold.removedNumbers.add(number);
|
|
2308
|
-
return true;
|
|
2309
|
-
}
|
|
2310
|
-
function coldInsert(hold, docId, vector, partitionId) {
|
|
2311
|
-
const replaced = retireOlderCopy(hold, docId);
|
|
2312
|
-
if (!replaced) hold.live += 1;
|
|
2313
|
-
hold.written.set(docId, { vector: vector.slice(), partitionId });
|
|
2314
|
-
return replaced;
|
|
2315
|
-
}
|
|
2316
|
-
function coldRemove(hold, docId) {
|
|
2317
|
-
const removed = retireOlderCopy(hold, docId);
|
|
2318
|
-
if (removed) hold.live -= 1;
|
|
2319
|
-
return removed;
|
|
2320
|
-
}
|
|
2321
2326
|
function coldHas(hold, docId) {
|
|
2322
2327
|
if (hold.written.has(docId)) return true;
|
|
2323
2328
|
if (hold.removedIds.has(docId)) return false;
|
|
@@ -2461,6 +2466,131 @@ async function coldSearchConcurrently(state, hold, query, k, options) {
|
|
|
2461
2466
|
return outcomeOfGraphWalk(hold, walk, fromGraph, query, k, options);
|
|
2462
2467
|
}
|
|
2463
2468
|
|
|
2469
|
+
// src/vector/vector-index/cold-writes.ts
|
|
2470
|
+
var encoder = new TextEncoder();
|
|
2471
|
+
var queuedWriteUndone = () => void 0;
|
|
2472
|
+
function sameVector(held, vector) {
|
|
2473
|
+
for (let at = 0; at < vector.length; at++) if (held[at] !== vector[at]) return false;
|
|
2474
|
+
return true;
|
|
2475
|
+
}
|
|
2476
|
+
function claimsOfField(hold, wanted) {
|
|
2477
|
+
const atMost = hold.field.claimsAtMost;
|
|
2478
|
+
const fits = atMost.slots + wanted.slots <= VECTOR_MEMORY_LIMITS.maxOrdinals && atMost.docIdBytes + wanted.docIdBytes <= VECTOR_MEMORY_LIMITS.maxDocIdTableBytes;
|
|
2479
|
+
return fits ? atMost : hold.field.claims();
|
|
2480
|
+
}
|
|
2481
|
+
function requireRoomInHold(hold, docId) {
|
|
2482
|
+
const { reserved } = hold;
|
|
2483
|
+
const wanted = { slots: reserved.slots + 1, docIdBytes: reserved.docIdBytes + encoder.encode(docId).length };
|
|
2484
|
+
const loaded = claimsOfField(hold, wanted);
|
|
2485
|
+
requireOrdinalWithinLimit(loaded.slots + reserved.slots);
|
|
2486
|
+
requireBytesWithinLimit(loaded.docIdBytes + wanted.docIdBytes, VECTOR_MEMORY_LIMITS.maxDocIdTableBytes);
|
|
2487
|
+
return wanted;
|
|
2488
|
+
}
|
|
2489
|
+
function reserveReplayedInsert(hold, docId) {
|
|
2490
|
+
const wanted = requireRoomInHold(hold, docId);
|
|
2491
|
+
const added = { slots: wanted.slots - hold.reserved.slots, docIdBytes: wanted.docIdBytes - hold.reserved.docIdBytes };
|
|
2492
|
+
hold.reserved.slots = wanted.slots;
|
|
2493
|
+
hold.reserved.docIdBytes = wanted.docIdBytes;
|
|
2494
|
+
return added;
|
|
2495
|
+
}
|
|
2496
|
+
function retireCopy(hold, docId) {
|
|
2497
|
+
const written = hold.written.get(docId);
|
|
2498
|
+
if (written !== void 0) {
|
|
2499
|
+
hold.written.delete(docId);
|
|
2500
|
+
return written;
|
|
2501
|
+
}
|
|
2502
|
+
if (hold.removedIds.has(docId)) return void 0;
|
|
2503
|
+
const number = hold.field.numberOf(docId);
|
|
2504
|
+
if (number === void 0) return void 0;
|
|
2505
|
+
hold.removedIds.add(docId);
|
|
2506
|
+
hold.removedNumbers.add(number);
|
|
2507
|
+
return number;
|
|
2508
|
+
}
|
|
2509
|
+
function vectorOfCopy(hold, copy) {
|
|
2510
|
+
return typeof copy === "number" ? hold.field.reusedVectorOfNumber(copy) : copy.vector;
|
|
2511
|
+
}
|
|
2512
|
+
function putBackCopy(hold, docId, copy) {
|
|
2513
|
+
if (typeof copy === "number") {
|
|
2514
|
+
hold.removedIds.delete(docId);
|
|
2515
|
+
hold.removedNumbers.delete(copy);
|
|
2516
|
+
} else {
|
|
2517
|
+
hold.written.set(docId, copy);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
function restoreRemovedCopy(hold, docId, vector) {
|
|
2521
|
+
const removal = hold.removals.get(docId);
|
|
2522
|
+
if (removal === void 0) return false;
|
|
2523
|
+
const { copy, queuedAt } = removal;
|
|
2524
|
+
if (!sameVector(vectorOfCopy(hold, copy), vector)) return false;
|
|
2525
|
+
hold.removals.delete(docId);
|
|
2526
|
+
hold.writes[queuedAt] = queuedWriteUndone;
|
|
2527
|
+
putBackCopy(hold, docId, copy);
|
|
2528
|
+
hold.live += 1;
|
|
2529
|
+
return true;
|
|
2530
|
+
}
|
|
2531
|
+
function keepReplacement(hold, docId, replacement) {
|
|
2532
|
+
const kept = hold.replacements.get(docId);
|
|
2533
|
+
if (kept === void 0) hold.replacements.set(docId, [replacement]);
|
|
2534
|
+
else kept.push(replacement);
|
|
2535
|
+
}
|
|
2536
|
+
function fieldHoldsVector(hold, docId, vector) {
|
|
2537
|
+
if (hold.removedIds.has(docId)) return false;
|
|
2538
|
+
const number = hold.field.numberOf(docId);
|
|
2539
|
+
return number !== void 0 && sameVector(hold.field.reusedVectorOfNumber(number), vector);
|
|
2540
|
+
}
|
|
2541
|
+
function coldInsert(hold, docId, vector, partitionId, keepsReplacedCopy, replay) {
|
|
2542
|
+
const restored = !hold.written.has(docId) && restoreRemovedCopy(hold, docId, vector);
|
|
2543
|
+
const written = hold.written.get(docId);
|
|
2544
|
+
if (written !== void 0 && sameVector(written.vector, vector)) {
|
|
2545
|
+
if (partitionId === void 0 || partitionId === written.partitionId) return restored;
|
|
2546
|
+
hold.written.set(docId, { vector: written.vector, partitionId });
|
|
2547
|
+
hold.writes.push(replay);
|
|
2548
|
+
return true;
|
|
2549
|
+
}
|
|
2550
|
+
if (written === void 0 && (restored || fieldHoldsVector(hold, docId, vector))) {
|
|
2551
|
+
if (partitionId === void 0) return restored;
|
|
2552
|
+
hold.writes.push(replay);
|
|
2553
|
+
return true;
|
|
2554
|
+
}
|
|
2555
|
+
const reserved = reserveReplayedInsert(hold, docId);
|
|
2556
|
+
const removal = hold.removals.get(docId);
|
|
2557
|
+
hold.removals.delete(docId);
|
|
2558
|
+
const retired = retireCopy(hold, docId);
|
|
2559
|
+
if (retired === void 0) hold.live += 1;
|
|
2560
|
+
const inserted = { vector, partitionId };
|
|
2561
|
+
hold.written.set(docId, inserted);
|
|
2562
|
+
const copy = removal === void 0 ? retired : removal.copy;
|
|
2563
|
+
if (keepsReplacedCopy && copy !== void 0) {
|
|
2564
|
+
const queuedAt = removal === void 0 ? [hold.writes.length] : [removal.queuedAt, hold.writes.length];
|
|
2565
|
+
keepReplacement(hold, docId, { copy, inserted, queuedAt, reserved });
|
|
2566
|
+
}
|
|
2567
|
+
hold.writes.push(replay);
|
|
2568
|
+
return true;
|
|
2569
|
+
}
|
|
2570
|
+
function coldRemove(hold, docId, replay) {
|
|
2571
|
+
const copy = retireCopy(hold, docId);
|
|
2572
|
+
if (copy === void 0) return false;
|
|
2573
|
+
hold.live -= 1;
|
|
2574
|
+
hold.removals.set(docId, { queuedAt: hold.writes.length, copy });
|
|
2575
|
+
hold.writes.push(replay);
|
|
2576
|
+
return true;
|
|
2577
|
+
}
|
|
2578
|
+
function coldRestore(hold, docId, vector) {
|
|
2579
|
+
if (!hold.written.has(docId)) return restoreRemovedCopy(hold, docId, vector);
|
|
2580
|
+
const replacements = hold.replacements.get(docId);
|
|
2581
|
+
const last = replacements?.[replacements.length - 1];
|
|
2582
|
+
if (replacements === void 0 || last === void 0 || hold.written.get(docId) !== last.inserted) return false;
|
|
2583
|
+
if (!sameVector(vectorOfCopy(hold, last.copy), vector)) return false;
|
|
2584
|
+
replacements.pop();
|
|
2585
|
+
if (replacements.length === 0) hold.replacements.delete(docId);
|
|
2586
|
+
for (const at of last.queuedAt) hold.writes[at] = queuedWriteUndone;
|
|
2587
|
+
hold.written.delete(docId);
|
|
2588
|
+
putBackCopy(hold, docId, last.copy);
|
|
2589
|
+
hold.reserved.slots -= last.reserved.slots;
|
|
2590
|
+
hold.reserved.docIdBytes -= last.reserved.docIdBytes;
|
|
2591
|
+
return true;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2464
2594
|
// src/vector/vector-index/flagged-documents.ts
|
|
2465
2595
|
var FlaggedDocuments = class {
|
|
2466
2596
|
constructor(store, layout) {
|
|
@@ -2545,8 +2675,10 @@ var FlaggedDocuments = class {
|
|
|
2545
2675
|
const ordinal = this.store.getOrdinal(docId);
|
|
2546
2676
|
const previous = this.ordinals.get(docId);
|
|
2547
2677
|
if (ordinal === void 0 || ordinal === previous) return;
|
|
2548
|
-
if (this.
|
|
2549
|
-
|
|
2678
|
+
if (!this.retired.delete(ordinal)) {
|
|
2679
|
+
if (this.chunks !== null) Atomics.add(this.chunks, Math.floor(ordinal / UNPLACED_FLAG_CHUNK_ORDINALS), 1);
|
|
2680
|
+
Atomics.store(this.flags, ordinal, 1);
|
|
2681
|
+
}
|
|
2550
2682
|
this.ordinals.set(docId, ordinal);
|
|
2551
2683
|
if (previous === void 0) return;
|
|
2552
2684
|
if (this.layout.keepsRetiredFlags) this.retired.add(previous);
|
|
@@ -2712,6 +2844,47 @@ function vectorPublicationSource(state) {
|
|
|
2712
2844
|
};
|
|
2713
2845
|
}
|
|
2714
2846
|
|
|
2847
|
+
// src/vector/vector-index/rollback-holds.ts
|
|
2848
|
+
function releaseHold(state, docId, hold) {
|
|
2849
|
+
hold.writes -= 1;
|
|
2850
|
+
if (hold.writes > 0) return;
|
|
2851
|
+
if (state.rollbackHolds.get(docId) === hold) state.rollbackHolds.delete(docId);
|
|
2852
|
+
for (const { view, pin } of hold.pins) storePinsOf(view).release(pin);
|
|
2853
|
+
hold.pins.length = 0;
|
|
2854
|
+
hold.ordinals.length = 0;
|
|
2855
|
+
state.cold?.replacements.delete(docId);
|
|
2856
|
+
}
|
|
2857
|
+
function holdForRollback(state, docId) {
|
|
2858
|
+
let hold = state.rollbackHolds.get(docId);
|
|
2859
|
+
if (hold === void 0) {
|
|
2860
|
+
hold = { writes: 0, ordinals: [], pins: [] };
|
|
2861
|
+
state.rollbackHolds.set(docId, hold);
|
|
2862
|
+
}
|
|
2863
|
+
hold.writes += 1;
|
|
2864
|
+
const held = hold;
|
|
2865
|
+
let released = false;
|
|
2866
|
+
return () => {
|
|
2867
|
+
if (released) return;
|
|
2868
|
+
released = true;
|
|
2869
|
+
releaseHold(state, docId, held);
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
function keepRetiredOrdinal(state, docId, ordinal) {
|
|
2873
|
+
const hold = state.rollbackHolds.get(docId);
|
|
2874
|
+
if (hold === void 0 || hold.ordinals[hold.ordinals.length - 1] === ordinal) return;
|
|
2875
|
+
const view = state.store.view;
|
|
2876
|
+
hold.pins.push({ view, pin: storePinsOf(view).take() });
|
|
2877
|
+
hold.ordinals.push(ordinal);
|
|
2878
|
+
}
|
|
2879
|
+
function forgetKeptOrdinal(state, docId, ordinal) {
|
|
2880
|
+
const ordinals = state.rollbackHolds.get(docId)?.ordinals;
|
|
2881
|
+
const at = ordinals?.lastIndexOf(ordinal) ?? -1;
|
|
2882
|
+
if (ordinals !== void 0 && at !== -1) ordinals.splice(at, 1);
|
|
2883
|
+
}
|
|
2884
|
+
function keptOrdinalsOf(state, docId) {
|
|
2885
|
+
return state.rollbackHolds.get(docId)?.ordinals ?? [];
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2715
2888
|
// src/vector/vector-index/search.ts
|
|
2716
2889
|
function* bufferCandidates(state, buffered, filter) {
|
|
2717
2890
|
for (const docId of buffered) {
|
|
@@ -3125,9 +3298,7 @@ function createVectorWrites(state) {
|
|
|
3125
3298
|
function holdsThisVectorAlready(docId, ordinal, vector) {
|
|
3126
3299
|
if (state.tombstones.has(docId)) return false;
|
|
3127
3300
|
const held = heldVectorOrUndefinedWhereItsFileFailsToRead(ordinal);
|
|
3128
|
-
|
|
3129
|
-
for (let i = 0; i < vector.length; i++) if (held[i] !== vector[i]) return false;
|
|
3130
|
-
return true;
|
|
3301
|
+
return held !== void 0 && sameVector(held, vector);
|
|
3131
3302
|
}
|
|
3132
3303
|
function forgetRetiredFlags() {
|
|
3133
3304
|
const oldestPin = state.store.oldestPin();
|
|
@@ -3144,27 +3315,69 @@ function createVectorWrites(state) {
|
|
|
3144
3315
|
}
|
|
3145
3316
|
return;
|
|
3146
3317
|
}
|
|
3318
|
+
state.store.requireRoomFor(docId);
|
|
3147
3319
|
noteWrite(state);
|
|
3148
3320
|
noteSearchedDocWritten(state, docId);
|
|
3149
3321
|
state.tombstones.delete(docId);
|
|
3150
|
-
const graphHoldsPrevious = previous !== void 0 && (
|
|
3322
|
+
const graphHoldsPrevious = previous !== void 0 && graphsHoldNode(previous);
|
|
3323
|
+
if (previous !== void 0) keepRetiredOrdinal(state, docId, previous);
|
|
3151
3324
|
state.store.insert(docId, vector, partitionId, graphHoldsPrevious);
|
|
3152
|
-
if (previous !== void 0)
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3325
|
+
if (previous !== void 0) retireFromGraphs(previous, graphHoldsPrevious);
|
|
3326
|
+
finishPlacingInBuffer(docId);
|
|
3327
|
+
}
|
|
3328
|
+
function graphsHoldNode(ordinal) {
|
|
3329
|
+
return (state.hnsw?.holdsNode(ordinal) ?? false) || (state.freshGraph?.holdsNode(ordinal) ?? false) || (state.growingCopy?.holdsNode(ordinal) ?? false);
|
|
3330
|
+
}
|
|
3331
|
+
function retireFromGraphs(previous, graphHoldsPrevious) {
|
|
3332
|
+
const graph = state.hnsw;
|
|
3333
|
+
const freshGraph = state.freshGraph;
|
|
3334
|
+
const growingCopy = state.growingCopy;
|
|
3335
|
+
afterGraphPass(state, () => {
|
|
3336
|
+
graph?.markTombstoneOrdinal(previous);
|
|
3337
|
+
freshGraph?.markTombstoneOrdinal(previous);
|
|
3338
|
+
growingCopy?.markTombstoneOrdinal(previous);
|
|
3339
|
+
});
|
|
3340
|
+
if (!graphHoldsPrevious) state.osq?.removeOrdinal(previous);
|
|
3341
|
+
}
|
|
3342
|
+
function finishPlacingInBuffer(docId) {
|
|
3163
3343
|
state.buffer.add(docId);
|
|
3164
3344
|
if (state.buffer.retiredCount !== 0) forgetRetiredFlags();
|
|
3165
3345
|
state.pendingLocations.delete(docId);
|
|
3166
3346
|
if (!threadsHoldCurrentLayout(state)) scheduleWorkerCopyLoad(state);
|
|
3167
3347
|
}
|
|
3348
|
+
function keptOrdinalHolding(docId, vector) {
|
|
3349
|
+
const kept = keptOrdinalsOf(state, docId);
|
|
3350
|
+
for (let at = kept.length - 1; at >= 0; at--) {
|
|
3351
|
+
const held = heldVectorOrUndefinedWhereItsFileFailsToRead(kept[at]);
|
|
3352
|
+
if (held !== void 0 && sameVector(held, vector)) return kept[at];
|
|
3353
|
+
}
|
|
3354
|
+
return void 0;
|
|
3355
|
+
}
|
|
3356
|
+
function applyRestore(docId, vector, partitionId) {
|
|
3357
|
+
const ordinal = keptOrdinalHolding(docId, vector);
|
|
3358
|
+
if (ordinal === void 0) return false;
|
|
3359
|
+
handOverBuildTurns(state);
|
|
3360
|
+
const current = state.store.getOrdinal(docId);
|
|
3361
|
+
if (current === ordinal && !state.tombstones.has(docId)) return true;
|
|
3362
|
+
const previous = current === ordinal ? void 0 : current;
|
|
3363
|
+
const graphHoldsPrevious = previous !== void 0 && graphsHoldNode(previous);
|
|
3364
|
+
if (!state.store.reclaim(docId, ordinal, partitionId, graphHoldsPrevious)) return false;
|
|
3365
|
+
forgetKeptOrdinal(state, docId, ordinal);
|
|
3366
|
+
noteWrite(state);
|
|
3367
|
+
noteSearchedDocWritten(state, docId);
|
|
3368
|
+
state.tombstones.delete(docId);
|
|
3369
|
+
if (previous !== void 0) retireFromGraphs(previous, graphHoldsPrevious);
|
|
3370
|
+
const graph = state.hnsw;
|
|
3371
|
+
const freshGraph = state.freshGraph;
|
|
3372
|
+
const growingCopy = state.growingCopy;
|
|
3373
|
+
afterGraphPass(state, () => {
|
|
3374
|
+
graph?.reviveOrdinal(ordinal);
|
|
3375
|
+
freshGraph?.reviveOrdinal(ordinal);
|
|
3376
|
+
growingCopy?.reviveOrdinal(ordinal);
|
|
3377
|
+
});
|
|
3378
|
+
finishPlacingInBuffer(docId);
|
|
3379
|
+
return true;
|
|
3380
|
+
}
|
|
3168
3381
|
function applyRemove(docId) {
|
|
3169
3382
|
handOverBuildTurns(state);
|
|
3170
3383
|
const ordinal = state.store.getOrdinal(docId);
|
|
@@ -3172,6 +3385,7 @@ function createVectorWrites(state) {
|
|
|
3172
3385
|
noteWrite(state);
|
|
3173
3386
|
noteSearchedDocWritten(state, docId);
|
|
3174
3387
|
state.tombstones.add(docId);
|
|
3388
|
+
keepRetiredOrdinal(state, docId, ordinal);
|
|
3175
3389
|
state.store.retire(ordinal);
|
|
3176
3390
|
state.buffer.retire(docId);
|
|
3177
3391
|
if (state.buffer.retiredCount !== 0) forgetRetiredFlags();
|
|
@@ -3192,10 +3406,32 @@ function createVectorWrites(state) {
|
|
|
3192
3406
|
applyInsert(docId, vector, partitionId);
|
|
3193
3407
|
return;
|
|
3194
3408
|
}
|
|
3195
|
-
noteWrite(state);
|
|
3196
|
-
coldInsert(hold, docId, vector, partitionId);
|
|
3197
3409
|
const held = vector.slice();
|
|
3198
|
-
|
|
3410
|
+
const keepsReplacedCopy = state.rollbackHolds.has(docId);
|
|
3411
|
+
if (coldInsert(hold, docId, held, partitionId, keepsReplacedCopy, () => applyInsert(docId, held, partitionId))) {
|
|
3412
|
+
noteWrite(state);
|
|
3413
|
+
}
|
|
3414
|
+
},
|
|
3415
|
+
restore(docId, vector, partitionId) {
|
|
3416
|
+
validateDimension(vector);
|
|
3417
|
+
for (const listener of state.writeListeners) listener(docId);
|
|
3418
|
+
const hold = state.cold;
|
|
3419
|
+
if (hold === null) {
|
|
3420
|
+
if (!applyRestore(docId, vector, partitionId)) applyInsert(docId, vector, partitionId);
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
if (coldRestore(hold, docId, vector)) {
|
|
3424
|
+
noteWrite(state);
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
const held = vector.slice();
|
|
3428
|
+
if (coldInsert(hold, docId, held, partitionId, false, () => applyInsert(docId, held, partitionId))) {
|
|
3429
|
+
noteWrite(state);
|
|
3430
|
+
}
|
|
3431
|
+
},
|
|
3432
|
+
requireRoomForNewVector(docId) {
|
|
3433
|
+
if (state.cold === null) state.store.requireRoomFor(docId);
|
|
3434
|
+
else requireRoomInHold(state.cold, docId);
|
|
3199
3435
|
},
|
|
3200
3436
|
remove(docId) {
|
|
3201
3437
|
for (const listener of state.writeListeners) listener(docId);
|
|
@@ -3204,9 +3440,7 @@ function createVectorWrites(state) {
|
|
|
3204
3440
|
applyRemove(docId);
|
|
3205
3441
|
return;
|
|
3206
3442
|
}
|
|
3207
|
-
if (
|
|
3208
|
-
noteWrite(state);
|
|
3209
|
-
hold.writes.push(() => applyRemove(docId));
|
|
3443
|
+
if (coldRemove(hold, docId, () => applyRemove(docId))) noteWrite(state);
|
|
3210
3444
|
}
|
|
3211
3445
|
};
|
|
3212
3446
|
}
|
|
@@ -3285,9 +3519,10 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
3285
3519
|
graphsHeldOffThread: null,
|
|
3286
3520
|
graphsPlacedIntoSinceConnect: /* @__PURE__ */ new WeakSet(),
|
|
3287
3521
|
searchWatches: /* @__PURE__ */ new Set(),
|
|
3288
|
-
writeListeners: /* @__PURE__ */ new Set()
|
|
3522
|
+
writeListeners: /* @__PURE__ */ new Set(),
|
|
3523
|
+
rollbackHolds: /* @__PURE__ */ new Map()
|
|
3289
3524
|
};
|
|
3290
|
-
const { insert, remove } = createVectorWrites(state);
|
|
3525
|
+
const { insert, remove, requireRoomForNewVector, restore: restoreVector } = createVectorWrites(state);
|
|
3291
3526
|
function getVector(docId) {
|
|
3292
3527
|
if (state.cold !== null) return coldVectorOf(state.cold, docId);
|
|
3293
3528
|
if (state.tombstones.has(docId)) return null;
|
|
@@ -3295,6 +3530,19 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
3295
3530
|
if (!entry) return null;
|
|
3296
3531
|
return new Float32Array(entry.vector);
|
|
3297
3532
|
}
|
|
3533
|
+
function requireRoomFor(docId, vector) {
|
|
3534
|
+
try {
|
|
3535
|
+
requireRoomForNewVector(docId);
|
|
3536
|
+
} catch (error) {
|
|
3537
|
+
const held = getVector(docId);
|
|
3538
|
+
if (held === null || held.length !== vector.length || !sameVector(held, vector)) throw error;
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
function restore(docId, vector, partitionId) {
|
|
3542
|
+
const held = getVector(docId);
|
|
3543
|
+
if (held !== null && held.length === vector.length && sameVector(held, vector)) return;
|
|
3544
|
+
restoreVector(docId, vector, partitionId);
|
|
3545
|
+
}
|
|
3298
3546
|
function has(docId) {
|
|
3299
3547
|
if (state.cold !== null) return coldHas(state.cold, docId);
|
|
3300
3548
|
return state.store.has(docId) && !state.tombstones.has(docId);
|
|
@@ -3355,6 +3603,9 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
3355
3603
|
return state.metric;
|
|
3356
3604
|
},
|
|
3357
3605
|
insert,
|
|
3606
|
+
requireRoomFor,
|
|
3607
|
+
restore,
|
|
3608
|
+
holdForRollback: (docId) => holdForRollback(state, docId),
|
|
3358
3609
|
remove,
|
|
3359
3610
|
partitionsKnown: () => state.cold !== null || state.store.partitionsKnown,
|
|
3360
3611
|
assignPartitions: (resolve) => {
|
|
@@ -3454,4 +3705,4 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
3454
3705
|
};
|
|
3455
3706
|
}
|
|
3456
3707
|
|
|
3457
|
-
export { compactVectors, createSharedVectorSearcher, createVectorIndex, executeHybridSearch, executeVectorSearch, filterSubsetsMatchNothing, getVectorMaintenanceStatus, optimizeVectors, vectorLegWith };
|
|
3708
|
+
export { compactVectors, createSharedVectorSearcher, createVectorIndex, executeHybridSearch, executeVectorSearch, filterSubsetsMatchNothing, getVectorMaintenanceStatus, optimizeVectors, requireUsableQueryVector, vectorLegWith };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { restoreVectorFields, setNestedValue } from './chunk-
|
|
1
|
+
export { restoreVectorFields, setNestedValue } from './chunk-I2WJCRIH.mjs';
|
|
2
2
|
export { encodeDocument } from './chunk-KLVMK3R5.mjs';
|
|
3
3
|
export { Decoder, MAP_TAGS, bindMsgpackHost, decode, decodeMulti, headerAt } from './chunk-GXCDWLQI.mjs';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-X5NHWOXT.mjs';
|
|
5
5
|
import './chunk-ZXX5GZEX.mjs';
|
|
6
6
|
import './chunk-4PY4JYMY.mjs';
|
|
7
7
|
import './chunk-Q3ZZH5Z7.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-
|
|
1
|
+
import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback } from './chunk-D6FYUTFN.mjs';
|
|
2
2
|
import './chunk-Q3ZZH5Z7.mjs';
|
|
3
3
|
|
|
4
4
|
// src/engine/optional-reads-host-bindings.ts
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { applyStoredIndexBm25, updateIndexBm25 } from './chunk-
|
|
2
|
-
import { readHeapStatistics, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, validateEmbeddingConfig } from './chunk-
|
|
3
|
-
export { bindOptionalWritesHost, insertDocument, insertDocumentBatch, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-
|
|
1
|
+
export { applyStoredIndexBm25, updateIndexBm25 } from './chunk-GO6TRSJ6.mjs';
|
|
2
|
+
import { readHeapStatistics, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, validateEmbeddingConfig } from './chunk-2C3BXZGA.mjs';
|
|
3
|
+
export { bindOptionalWritesHost, holdVectorsForRollback, insertDocument, insertDocumentBatch, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-2C3BXZGA.mjs';
|
|
4
4
|
import './chunk-KLVMK3R5.mjs';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-LPRRFCVU.mjs';
|
|
6
6
|
import './chunk-GXCDWLQI.mjs';
|
|
7
7
|
import { isSyncEpoch, newSyncEpoch } from './chunk-BUMREPLU.mjs';
|
|
8
8
|
import './chunk-7T4LAYT4.mjs';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-
|
|
9
|
+
import './chunk-YM2HI5N5.mjs';
|
|
10
|
+
import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-X5NHWOXT.mjs';
|
|
11
11
|
import './chunk-U2BKYEC7.mjs';
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
12
|
+
import './chunk-DG6WIEB3.mjs';
|
|
13
|
+
import './chunk-JP77OWMI.mjs';
|
|
14
|
+
import './chunk-D6FYUTFN.mjs';
|
|
15
15
|
import './chunk-ZXX5GZEX.mjs';
|
|
16
16
|
import './chunk-4PY4JYMY.mjs';
|
|
17
17
|
import { NarsilError, ErrorCodes } from './chunk-Q3ZZH5Z7.mjs';
|
|
@@ -84,21 +84,26 @@ function recoveryFailure(metadata, err) {
|
|
|
84
84
|
stopWords: metadata.stopWords
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
async function
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
async function savedPartitionCountOf(metadata) {
|
|
88
|
+
const count = metadata.partitionCount;
|
|
89
|
+
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 1) {
|
|
90
|
+
const held = typeof count === "number" ? String(count) : `a ${typeof count} as its count of`;
|
|
91
|
+
throw new NarsilError(
|
|
92
|
+
ErrorCodes.PERSISTENCE_LOAD_FAILED,
|
|
93
|
+
`Recovery of index "${metadata.indexName}" failed: its metadata holds ${held} partitions, and an index holds a whole number above zero`,
|
|
94
|
+
{ indexName: metadata.indexName, partitionCount: typeof count === "number" ? count : typeof count }
|
|
95
|
+
);
|
|
90
96
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
while (manager.partitionCount < metadata.partitionCount) manager.addPartition();
|
|
95
|
-
if (manager.partitionCount > metadata.partitionCount) {
|
|
96
|
-
manager.setPartitions(manager.getAllPartitions().slice(0, metadata.partitionCount));
|
|
97
|
-
}
|
|
98
|
-
});
|
|
97
|
+
const { requireSavedPartitionCount } = await loadStorageCode();
|
|
98
|
+
requireSavedPartitionCount(count, "metadata", metadata.indexName);
|
|
99
|
+
return count;
|
|
99
100
|
}
|
|
100
101
|
async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
101
|
-
const loadingSchemaCode =
|
|
102
|
+
const loadingSchemaCode = loadSchemaCodeFor(
|
|
103
|
+
loadData ? metadata.schema : null,
|
|
104
|
+
metadata.tokenizer,
|
|
105
|
+
metadata.pendingAnalysis?.tokenizer
|
|
106
|
+
);
|
|
102
107
|
if (loadingSchemaCode !== null) await loadingSchemaCode;
|
|
103
108
|
const existing = deps.indexRegistry.get(metadata.indexName);
|
|
104
109
|
if (existing !== void 0) {
|
|
@@ -107,14 +112,15 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
107
112
|
adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
|
|
108
113
|
}
|
|
109
114
|
if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
|
|
115
|
+
const partitionCount2 = await savedPartitionCountOf(metadata);
|
|
110
116
|
deps.executor.createIndex(
|
|
111
117
|
metadata.indexName,
|
|
112
118
|
existing.config,
|
|
113
119
|
existing.language,
|
|
114
120
|
false,
|
|
115
|
-
lookupOfStoredSynonyms(existing.synonyms, existing.config, existing.language)
|
|
121
|
+
lookupOfStoredSynonyms(existing.synonyms, existing.config, existing.language),
|
|
122
|
+
partitionCount2
|
|
116
123
|
);
|
|
117
|
-
await restorePartitionCount(deps, metadata);
|
|
118
124
|
}
|
|
119
125
|
return;
|
|
120
126
|
}
|
|
@@ -127,6 +133,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
127
133
|
} catch (err) {
|
|
128
134
|
throw recoveryFailure(metadata, err);
|
|
129
135
|
}
|
|
136
|
+
const partitionCount = await savedPartitionCountOf(metadata);
|
|
130
137
|
const embedding = resolveEmbeddingAdapter(deps, metadata, indexConfig.schema);
|
|
131
138
|
const prepared = prepareStoredSynonyms(
|
|
132
139
|
metadata.synonyms,
|
|
@@ -139,8 +146,14 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
139
146
|
validateVectorStorage(indexConfig.vectorPromotion, deps.filesystemDurability);
|
|
140
147
|
validateTextStorage(indexConfig.textStorage, deps.filesystemDurability);
|
|
141
148
|
if (loadData) {
|
|
142
|
-
deps.executor.createIndex(
|
|
143
|
-
|
|
149
|
+
deps.executor.createIndex(
|
|
150
|
+
metadata.indexName,
|
|
151
|
+
indexConfig,
|
|
152
|
+
language,
|
|
153
|
+
false,
|
|
154
|
+
prepared?.lookup ?? null,
|
|
155
|
+
partitionCount
|
|
156
|
+
);
|
|
144
157
|
}
|
|
145
158
|
} catch (err) {
|
|
146
159
|
throw recoveryFailure(metadata, err);
|
|
@@ -154,7 +167,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
154
167
|
indexUuid: metadata.indexUuid ?? null,
|
|
155
168
|
heldPartitions: metadata.heldPartitions ?? null,
|
|
156
169
|
documentCount: metadata.documentCount ?? 0,
|
|
157
|
-
partitionCount
|
|
170
|
+
partitionCount,
|
|
158
171
|
analysisRevision: metadata.analysisRevision ?? null,
|
|
159
172
|
arrayPositionGap: metadata.arrayPositionGap ?? null,
|
|
160
173
|
synonyms,
|