@delali/narsil 0.3.1-next.185 → 0.3.1-next.193
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 +1 -0
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/browser/chunk-4E5APHTM.mjs +1459 -0
- package/dist/browser/{chunk-4ZICWS4V.mjs → chunk-QAOVAYAG.mjs} +1 -1
- package/dist/browser/{chunk-CPSHS46N.mjs → chunk-UQG4HUGQ.mjs} +82 -50
- package/dist/browser/{chunk-2Q45HI5H.mjs → chunk-YINZFPLT.mjs} +7 -0
- package/dist/browser/{module-XVLHJ7T7.mjs → module-ZZTNG5JZ.mjs} +26 -3
- package/dist/browser/{optional-writes-ZTBHYQMN.mjs → optional-writes-J5BHKEQL.mjs} +21 -8
- package/dist/browser/{storage-leaf-4XMCITJ6.mjs → storage-leaf-N3JMQ6CF.mjs} +14569 -13747
- package/dist/{capabilities-DAHXphRn.d.ts → capabilities-CLnQHIqV.d.ts} +51 -9
- package/dist/{chunk-KLVMK3R5.mjs → chunk-2CKDCC65.mjs} +1 -1
- package/dist/{chunk-CODGHJVW.mjs → chunk-2HVQYOOD.mjs} +40 -12
- package/dist/{chunk-M5I64AQW.mjs → chunk-3N5GUXBI.mjs} +33 -33
- package/dist/{chunk-DU23J5JG.mjs → chunk-5CIHQIA4.mjs} +6 -6
- package/dist/{react-native/chunks/chunk-ZUFOYZ5P.mjs → chunk-62X472AC.mjs} +1 -1
- package/dist/{chunk-QJGDB3WR.mjs → chunk-6GHX35ZM.mjs} +2 -2
- package/dist/{chunk-G3XRHAJA.mjs → chunk-6MC6BCXK.mjs} +3 -3
- package/dist/{chunk-X5NHWOXT.mjs → chunk-7P5YWDRQ.mjs} +2 -2
- package/dist/{chunk-MHBG33R5.mjs → chunk-7X4IIREW.mjs} +76 -46
- package/dist/{chunk-F4OOBPKA.mjs → chunk-AOYQTX6W.mjs} +1 -1
- package/dist/{chunk-D6FYUTFN.mjs → chunk-ASZLNVWW.mjs} +1 -1
- package/dist/{chunk-LR6JJVML.mjs → chunk-D2EJUM4A.mjs} +764 -699
- package/dist/{chunk-FETZYCH7.mjs → chunk-F6F4G322.mjs} +26 -1
- package/dist/{chunk-2YWWHMVC.mjs → chunk-FGOGT273.mjs} +2 -2
- package/dist/{chunk-5BUEBIXR.mjs → chunk-GLXLSPLO.mjs} +18 -5
- package/dist/{chunk-IE3Q62QD.mjs → chunk-GR5GMFJJ.mjs} +1 -1
- package/dist/{chunk-Y7QUFIGV.mjs → chunk-GXED6R3Q.mjs} +2 -2
- package/dist/{chunk-BVZWWMOU.mjs → chunk-HHYQMGPW.mjs} +2 -2
- package/dist/{chunk-SL53DHVE.mjs → chunk-HSA3H3VW.mjs} +121 -68
- package/dist/{chunk-YM2HI5N5.mjs → chunk-IL5DRCNU.mjs} +2 -2
- package/dist/{chunk-JDG6CCXM.mjs → chunk-JENWA4WX.mjs} +2 -2
- package/dist/{chunk-2GONI5HL.mjs → chunk-JXINPXRS.mjs} +5 -4
- package/dist/chunk-K5GNK5GE.mjs +602 -0
- package/dist/{chunk-WLFOLAQI.mjs → chunk-KBU3ZFJN.mjs} +2 -2
- package/dist/{chunk-EDEE7ETQ.mjs → chunk-KOA6T2IC.mjs} +3 -3
- package/dist/{chunk-N3M4NPML.mjs → chunk-M2Z5WVWW.mjs} +1 -1
- package/dist/{chunk-EWGIF6FQ.mjs → chunk-NJJN4FMM.mjs} +1 -1
- package/dist/{chunk-C7YQHCSO.mjs → chunk-P4F4UWLC.mjs} +1 -1
- package/dist/{chunk-VYSWVQCE.mjs → chunk-PAPQGC6I.mjs} +2 -2
- package/dist/{chunk-I2WJCRIH.mjs → chunk-R2PJKSNL.mjs} +1 -1
- package/dist/{chunk-6SZQETSC.mjs → chunk-RORNUNXW.mjs} +5 -2
- package/dist/{chunk-FBQYC5OX.mjs → chunk-SB5HCIIO.mjs} +16 -13
- package/dist/{chunk-CYCVPTTR.mjs → chunk-SCZI7COG.mjs} +2 -2
- package/dist/{chunk-O337MDRJ.mjs → chunk-SHES4VP5.mjs} +38 -13
- package/dist/{chunk-H4QYQ5DE.mjs → chunk-SIIDIGKI.mjs} +2 -2
- package/dist/{chunk-A3OAFUZI.mjs → chunk-SM2SYVIX.mjs} +2 -2
- package/dist/{chunk-II6XF6M4.mjs → chunk-SMLUZGSI.mjs} +9 -8
- package/dist/{chunk-2KCCQK4R.mjs → chunk-TSE2VWPX.mjs} +2 -2
- package/dist/{chunk-WSIU6YXQ.mjs → chunk-YPEJ6ODL.mjs} +1732 -743
- package/dist/{chunk-7WXGUTWK.mjs → chunk-Z6SIJH5O.mjs} +17 -6
- package/dist/{chunk-Q3ZZH5Z7.mjs → chunk-ZKOQR7EA.mjs} +7 -0
- package/dist/{chunk-CKEOTSF5.mjs → chunk-ZS2YUB2L.mjs} +6 -3
- package/dist/{chunk-FCQMZDRI.mjs → chunk-ZVZYJIIP.mjs} +3 -3
- package/dist/{client-DpqtT2XG.d.ts → client-uB0kp2yT.d.ts} +88 -5
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +3 -1265
- package/dist/{config-D9WR3MhO.d.ts → config-BvHQ-C7U.d.ts} +3 -3
- package/dist/{config-C687-reW.d.ts → config-PqgNY1H7.d.ts} +1 -1
- package/dist/{core-leaf-NEUM7PU3.mjs → core-leaf-TAR3GJVE.mjs} +3 -3
- package/dist/{direct-executor-37IH3ISS.mjs → direct-executor-WSZALYCV.mjs} +8 -8
- package/dist/distribution/coordinator/etcd.d.ts +1 -1
- package/dist/distribution/coordinator/etcd.mjs +35 -15
- package/dist/distribution/coordinator/in-memory.d.ts +1 -1
- package/dist/distribution/coordinator/in-memory.mjs +16 -6
- package/dist/distribution/transport/grpc.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +2 -2
- package/dist/distribution.d.ts +70 -9
- package/dist/distribution.mjs +1695 -680
- package/dist/{durability-config-NWU2G2SJ.mjs → durability-config-VWS2K24E.mjs} +1 -1
- package/dist/{react-native/chunks/embed-4LBSQD7U.mjs → embed-4PHHKGBK.mjs} +1 -1
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-De6JzTW8.d.ts → engine-qjAxJSKk.d.ts} +206 -7
- package/dist/{index-CBUl4z3E.d.ts → index-BaQIAnk0.d.ts} +137 -111
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +8 -8
- package/dist/index.react-native.mjs +9 -9
- package/dist/{long-query-thread-DIPJBMV7.mjs → long-query-thread-N2DNPEA3.mjs} +21 -21
- package/dist/{module-Z3CL4GJ4.mjs → module-UQFIJQMG.mjs} +33 -13
- package/dist/{msgpack-leaf-7KBYOVTF.mjs → msgpack-leaf-H5ZYW7S7.mjs} +4 -4
- package/dist/{optional-reads-ENKMVQ4Q.mjs → optional-reads-5HFMF2QZ.mjs} +2 -2
- package/dist/{optional-writes-YIVJMQ4D.mjs → optional-writes-CGDBJBHQ.mjs} +31 -18
- package/dist/{paged-partition-archive-IZ6U7DVN.mjs → paged-partition-archive-UK44CVXG.mjs} +20 -20
- package/dist/partial-words.browser.mjs +3 -3
- package/dist/partial-words.mjs +8 -8
- package/dist/pattern.browser.mjs +2 -2
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +7 -0
- package/dist/persistence/durability/checkpoint-worker.mjs +18 -18
- package/dist/{phrase-module-ZY3TLTQA.mjs → phrase-module-EFESWOCR.mjs} +2 -2
- package/dist/{query-actions-7EOKT3WD.mjs → query-actions-7BL3YZDW.mjs} +8 -8
- package/dist/query-suggestions/merge-worker.mjs +11 -11
- package/dist/query-suggestions.browser.mjs +3 -3
- package/dist/query-suggestions.d.ts +1 -1
- package/dist/query-suggestions.mjs +9 -9
- package/dist/react-native/chunks/{chunk-TQ26BKBH.mjs → chunk-43R4GCM7.mjs} +7 -0
- package/dist/react-native/chunks/{chunk-CBU4M3EU.mjs → chunk-63DZ26X5.mjs} +277 -75
- package/dist/react-native/chunks/{chunk-BN6FUB7N.mjs → chunk-AN4HKLB4.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-T5HF3FW3.mjs → chunk-BNFGA7TY.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-PVMEHBQO.mjs → chunk-CW2ZFXSE.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-NLEFMPY3.mjs → chunk-G434H5WG.mjs} +15 -4
- package/dist/react-native/chunks/{chunk-SK3DPAI4.mjs → chunk-HTBY4GON.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-ZQPSXN6C.mjs → chunk-IP3QLETQ.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-7TPO4FLE.mjs → chunk-LOKGE4OQ.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-ZDDJVR7X.mjs → chunk-MRH36RN3.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-YOTP2FPE.mjs → chunk-UO44MA5M.mjs} +1 -1
- package/dist/{chunk-4JBTALUC.mjs → react-native/chunks/chunk-UYAZLGEM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-WFQ6YQZA.mjs → chunk-UYKIV2KT.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-IEY4DARA.mjs → chunk-XHYOQ4K4.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-OZ3XEM6D.mjs → chunk-ZUJCUPVS.mjs} +1 -1
- package/dist/react-native/chunks/{core-leaf-TPBRRWVN.mjs → core-leaf-5PVST5PR.mjs} +4 -4
- package/dist/react-native/chunks/{durability-config-RVTWSXPH.mjs → durability-config-FCSD4MXY.mjs} +1 -1
- package/dist/{embed-2QMYCD2Q.mjs → react-native/chunks/embed-HA2I7RCF.mjs} +1 -1
- package/dist/react-native/chunks/{gzip.react-native-DLO4WW27.mjs → gzip.react-native-CVM4NQG2.mjs} +2 -2
- package/dist/react-native/chunks/{module-COLNJNML.mjs → module-QRCYB7QV.mjs} +32 -9
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +7 -0
- package/dist/react-native/chunks/{optional-reads-74HYI4DO.mjs → optional-reads-AFPO2FEB.mjs} +3 -3
- package/dist/react-native/chunks/{optional-writes-QETIM6BI.mjs → optional-writes-GC6JWMAF.mjs} +31 -18
- package/dist/react-native/chunks/{phrase-module-UC4YGEBB.mjs → phrase-module-IGYBK7XH.mjs} +3 -3
- package/dist/react-native/chunks/{resolve-vector-text-FU7D4QP5.mjs → resolve-vector-text-GE2CRJKI.mjs} +1 -1
- package/dist/react-native/chunks/{restore-queue-3E2MJIJS.mjs → restore-queue-2ACONS4W.mjs} +12 -12
- package/dist/react-native/chunks/{segment-codec-leaf-IE4DXUZV.mjs → segment-codec-leaf-SSIWXVUG.mjs} +10 -10
- package/dist/react-native/chunks/{segment-merge-leaf-62LQ5WZB.mjs → segment-merge-leaf-I2WDFE6O.mjs} +11 -11
- package/dist/react-native/chunks/{storage-leaf-LNOLKWZB.mjs → storage-leaf-YXXMG4VR.mjs} +14727 -13915
- package/dist/react-native/chunks/{store-leaf-Y7CBOPFZ.mjs → store-leaf-FS7A4PZA.mjs} +11 -11
- package/dist/react-native/chunks/{suggestions-leaf-PSUGL6MI.mjs → suggestions-leaf-PSFCT5EX.mjs} +11 -11
- package/dist/react-native/chunks/{worker-copies-MW5O5U3D.mjs → worker-copies-QRMISMEL.mjs} +10 -10
- package/dist/react-native/partial-words.mjs +9 -9
- package/dist/react-native/pattern.mjs +5 -5
- package/dist/react-native/query-suggestions.mjs +9 -9
- package/dist/react-native/sync.mjs +433 -51
- package/dist/react-native/synonyms.mjs +9 -9
- package/dist/react.d.ts +8 -8
- package/dist/react.mjs +7 -0
- package/dist/{rerank-KTV5L7MZ.mjs → rerank-4GFC26FD.mjs} +8 -8
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{resolve-vector-text-SD6BEMKZ.mjs → resolve-vector-text-OD4J3WHF.mjs} +2 -2
- package/dist/{restore-queue-ES7TDJ5V.mjs → restore-queue-E4EIUYVV.mjs} +11 -11
- package/dist/{segment-codec-leaf-DO75VKEV.mjs → segment-codec-leaf-MP6DILVE.mjs} +9 -9
- package/dist/{segment-merge-leaf-JGND6LG5.mjs → segment-merge-leaf-ED2NMUC5.mjs} +9 -9
- package/dist/server.d.ts +13 -9
- package/dist/server.mjs +875 -348
- package/dist/{storage-leaf-ZI3H2WJY.mjs → storage-leaf-HQFO37W7.mjs} +5234 -5835
- package/dist/{store-leaf-YIH36Y5J.mjs → store-leaf-PL2G7RM5.mjs} +10 -10
- package/dist/{suggestions-leaf-FP5HSTFP.mjs → suggestions-leaf-I3MEHACP.mjs} +12 -12
- package/dist/sync/filesystem.d.ts +2 -2
- package/dist/sync/filesystem.mjs +16 -16
- package/dist/sync/indexeddb.browser.mjs +1 -1
- package/dist/sync/indexeddb.d.ts +2 -2
- package/dist/sync/indexeddb.mjs +3 -3
- package/dist/sync.browser.mjs +35 -1108
- package/dist/sync.d.ts +3 -3
- package/dist/sync.mjs +430 -51
- package/dist/synonyms.browser.mjs +3 -3
- package/dist/synonyms.mjs +8 -8
- package/dist/{tasks-X2IJQc8J.d.ts → tasks-C65V7lIr.d.ts} +3 -3
- package/dist/thread-LTFI3RK5.mjs +31 -0
- package/dist/{types-D0YasjoX.d.ts → types-CpCg-Gq-.d.ts} +1 -1
- package/dist/vector/search-worker.mjs +5 -5
- package/dist/{worker-copies-WYPRCNB7.mjs → worker-copies-P7YWXEP5.mjs} +11 -11
- package/dist/workers/entry.mjs +14 -14
- package/openapi.json +144 -0
- package/package.json +5 -7
- package/dist/chunk-URVH6BLO.mjs +0 -217
- package/dist/react-native/chunks/msgpack-leaf-GTKLF6GJ.mjs +0 -7
- package/dist/thread-NQRNW3IH.mjs +0 -31
- /package/dist/{chunk-CV3Q2EKO.mjs → chunk-S5QMWECL.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes, requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-
|
|
1
|
+
import { NarsilError, ErrorCodes, requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-YINZFPLT.mjs';
|
|
2
2
|
|
|
3
3
|
// src/core/stored-values/build.ts
|
|
4
4
|
var ORDINAL_LIMIT = 4294967295;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, storedText, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, discardStoredValues, storedValuesOf, bitsetHas, createBitSet,
|
|
1
|
+
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, storedText, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, discardStoredValues, bitsetIsEmpty, storedValuesOf, bitsetHas, createBitSet, bitsetSet, storedValueBytes, prepareStoredValues, cachedStoredFields, bitsetClear, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, buildStoredValues, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, checkedSize, fuzzyPrefixOf, boundedLevenshtein, installStoredFields, FILTER_OPERAND_COPY_DEPTH, fuzzyTermMatches, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES, bitsetIterator, GrowableUint32, bitsetFromSet } from './chunk-QAOVAYAG.mjs';
|
|
2
2
|
import { newSyncEpoch, isSyncEpoch } from './chunk-YJHGOJAC.mjs';
|
|
3
|
-
import { parsedTypeOf, NarsilError, ErrorCodes, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, createNarsilError, withUnpairedSurrogatesReplaced, tokenizeOptions, getNestedValue, isPlainObject, MAX_NESTING_DEPTH, loadMessagePack, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, extractVectorFieldsFromSchema, loadedMessagePack, flattenSchema, vectorDimensionOf, isSingleStringFieldType, schemaFieldsOf, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, isStringValuedBase, compareCodePoints, isWordIndexedFieldType, messagePackUpperBoundBytes, toComparableSortValue, exceedsCodePoints, SORT_VALUE_MAX_CODE_POINTS, PROTOTYPE_POLLUTION_KEYS,
|
|
3
|
+
import { parsedTypeOf, NarsilError, ErrorCodes, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, createNarsilError, withUnpairedSurrogatesReplaced, tokenizeOptions, getNestedValue, isPlainObject, MAX_NESTING_DEPTH, loadMessagePack, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, extractVectorFieldsFromSchema, loadedMessagePack, flattenSchema, vectorDimensionOf, isSingleStringFieldType, schemaFieldsOf, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, isStringValuedBase, compareCodePoints, isWordIndexedFieldType, messagePackUpperBoundBytes, toComparableSortValue, exceedsCodePoints, SORT_VALUE_MAX_CODE_POINTS, PROTOTYPE_POLLUTION_KEYS, sortModeOf, defaultSortMode, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, getOrCreateFieldNameIndex, isWordIndexedBase, holdsUnpairedSurrogate, validateRequiredFields, requireDocumentWithinSizeLimit, isNarsilError, PLACEMENT_ROOM_REQUESTS, NEAREST_LINK_FALLBACK_HOSTS, MIN_M, MAX_M, MAX_LAYER_CAP, MAX_FILE_BYTES, INITIAL_UPPER_SLOTS, INITIAL_LIST_CAPACITY, FARTHEST_REJECTED_LINKS_KEPT, EARLIER_RELEASE_MIN_M, DEFAULT_EF_SEARCH, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, CONNECT_RESTARTS_BEFORE_ONE_PASS, COMPACTION_TOMBSTONE_RATIO, COMPACTION_ABSOLUTE_THRESHOLD, requireValidFieldTypes, parseVectorDimension, isStorageMode, isQuantizationMode, VALID_HNSW_METRICS, MAX_DOCUMENT_NESTING_DEPTH, NATIVE_CRC32_MIN_BYTES, CHECKSUM_YIELD_CHUNK_BYTES, raiseEarlierReleaseGraphSetting, MAX_DOCUMENT_ENCODING_DEPTH, DOCUMENT_REPLY_ENVELOPE_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER, withSortableOption, VECTOR_PATTERN, isListBase, isGeopointOrVectorType, MAX_COVERING_CELLS, LOCATION_CODE_BITS_PER_AXIS, LOCATION_CELLS_PER_AXIS, FULL_TURN_DEGREES, EARTH_RADIUS_METERS, DEG_TO_RAD, ANTIMERIDIAN_SPAN_DEGREES, truncateSortString, SORT_MODES, isSortMode, codePointCount } from './chunk-YINZFPLT.mjs';
|
|
4
4
|
|
|
5
5
|
// src/analysis/registry.ts
|
|
6
6
|
var tokenizers = /* @__PURE__ */ new Map();
|
|
@@ -12384,7 +12384,7 @@ var loadSegmentCodec = segmentCodec.load;
|
|
|
12384
12384
|
|
|
12385
12385
|
// src/engine/optional-writes-code.ts
|
|
12386
12386
|
var optionalWrites = codeLoader(async () => {
|
|
12387
|
-
const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-
|
|
12387
|
+
const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-J5BHKEQL.mjs')]);
|
|
12388
12388
|
code7.bindOptionalWritesHost(optionalCodeHost(), segmentCodec2);
|
|
12389
12389
|
return code7;
|
|
12390
12390
|
}, "write");
|
|
@@ -13867,7 +13867,7 @@ var loadVectorCore = vectorCore.load;
|
|
|
13867
13867
|
|
|
13868
13868
|
// src/workers/vector-code.ts
|
|
13869
13869
|
var vectorCode = codeLoader(async () => {
|
|
13870
|
-
const [vectorCore2, code7] = await Promise.all([loadVectorCore(), import('./module-
|
|
13870
|
+
const [vectorCore2, code7] = await Promise.all([loadVectorCore(), import('./module-ZZTNG5JZ.mjs')]);
|
|
13871
13871
|
code7.bindVectorHost(optionalCodeHost(), vectorCore2);
|
|
13872
13872
|
return code7;
|
|
13873
13873
|
}, "vector");
|
|
@@ -14107,6 +14107,7 @@ async function createEngineIndex(core2, config, name, requestedConfig, creation
|
|
|
14107
14107
|
pendingAnalysis: null,
|
|
14108
14108
|
durableAnalysis: null,
|
|
14109
14109
|
sync: null,
|
|
14110
|
+
changes: null,
|
|
14110
14111
|
querySuggestions: creation.querySuggestions ?? null
|
|
14111
14112
|
});
|
|
14112
14113
|
await core2.indexState.registerOpen(name);
|
|
@@ -14136,11 +14137,12 @@ async function dropEngineIndex(core2, name) {
|
|
|
14136
14137
|
throw error;
|
|
14137
14138
|
}
|
|
14138
14139
|
}
|
|
14139
|
-
if (core2.executor.getManager(name) !== void 0) core2.executor.dropIndex(name);
|
|
14140
|
+
if (core2.executor.getManager(name) !== void 0) await core2.executor.dropIndex(name);
|
|
14140
14141
|
core2.indexRegistry.delete(name);
|
|
14141
14142
|
core2.watermarkNotifier.forget(name);
|
|
14142
14143
|
core2.analysisRebuild.clearStale(name);
|
|
14143
|
-
if (entry.sync !== null
|
|
14144
|
+
if (entry.sync !== null || entry.changes !== null)
|
|
14145
|
+
emitSyncChange(core2.indexRegistry, { kind: "dropped", indexName: name });
|
|
14144
14146
|
});
|
|
14145
14147
|
await core2.querySuggestionHooks?.afterDrop(name);
|
|
14146
14148
|
await runLifecycleHook(core2, "onIndexDrop", { indexName: name, config: entry.config });
|
|
@@ -18281,14 +18283,27 @@ function ownReadsOf(current, vectorIndexes) {
|
|
|
18281
18283
|
}
|
|
18282
18284
|
};
|
|
18283
18285
|
}
|
|
18284
|
-
function
|
|
18286
|
+
function createSearchRetirement(pins, indexName, pending = /* @__PURE__ */ new Map()) {
|
|
18287
|
+
return (free) => {
|
|
18288
|
+
pins.afterRelease(() => {
|
|
18289
|
+
const disposal = free();
|
|
18290
|
+
if (disposal === void 0) return;
|
|
18291
|
+
pending.set(disposal, indexName);
|
|
18292
|
+
void disposal.then(
|
|
18293
|
+
() => pending.delete(disposal),
|
|
18294
|
+
() => pending.delete(disposal)
|
|
18295
|
+
);
|
|
18296
|
+
});
|
|
18297
|
+
const disposals = [...pending].filter(([, owner]) => owner === indexName).map(([disposal]) => disposal);
|
|
18298
|
+
return Promise.all(disposals).then(() => void 0);
|
|
18299
|
+
};
|
|
18300
|
+
}
|
|
18301
|
+
function replaceVectorIndexes(current, replacement, retire) {
|
|
18285
18302
|
const kept = new Set(replacement.values());
|
|
18286
18303
|
const retired = [...current.values()].filter((index) => !kept.has(index));
|
|
18287
18304
|
current.clear();
|
|
18288
18305
|
for (const [field, index] of replacement) current.set(field, index);
|
|
18289
|
-
|
|
18290
|
-
for (const index of retired) index.dispose();
|
|
18291
|
-
});
|
|
18306
|
+
return retire(() => Promise.all(retired.map((index) => index.dispose())).then(() => void 0));
|
|
18292
18307
|
}
|
|
18293
18308
|
function watchVectorWritesFor(vectorIndexes, pins) {
|
|
18294
18309
|
const watched = /* @__PURE__ */ new Map();
|
|
@@ -18820,7 +18835,7 @@ function partitionStatsOf(partitions) {
|
|
|
18820
18835
|
}
|
|
18821
18836
|
|
|
18822
18837
|
// src/partitioning/manager/index.ts
|
|
18823
|
-
function createPartitionManager(indexName, initialConfig, initialLanguage, router, initialPartitionCount, vectorIndexes) {
|
|
18838
|
+
function createPartitionManager(indexName, initialConfig, initialLanguage, router, initialPartitionCount, vectorIndexes, pendingDisposals) {
|
|
18824
18839
|
let config = initialConfig;
|
|
18825
18840
|
let language = initialLanguage;
|
|
18826
18841
|
requirePatternSearchFor(config.schema);
|
|
@@ -18835,6 +18850,7 @@ function createPartitionManager(indexName, initialConfig, initialLanguage, route
|
|
|
18835
18850
|
const docPartitionMap = createDocIdMap();
|
|
18836
18851
|
const writeLogs = createWriteLogRecorder();
|
|
18837
18852
|
const pins = createStatePins(() => [...vecIndexes.keys()]);
|
|
18853
|
+
const afterSearchesRelease = createSearchRetirement(pins, indexName, pendingDisposals);
|
|
18838
18854
|
const vectorWrites = watchVectorWritesFor(vecIndexes, pins);
|
|
18839
18855
|
const ownReads = ownReadsOf({ locate: locateDocument, partitionOf }, vecIndexes);
|
|
18840
18856
|
for (let i = 0; i < count; i++) {
|
|
@@ -19062,9 +19078,7 @@ function createPartitionManager(indexName, initialConfig, initialLanguage, route
|
|
|
19062
19078
|
vectorWrites.watch();
|
|
19063
19079
|
return pins.open(reads ?? ownReads.current());
|
|
19064
19080
|
},
|
|
19065
|
-
afterSearchesRelease
|
|
19066
|
-
pins.afterRelease(free);
|
|
19067
|
-
},
|
|
19081
|
+
afterSearchesRelease,
|
|
19068
19082
|
fieldValues(docId, fieldPaths) {
|
|
19069
19083
|
const pid = locateDocument(docId);
|
|
19070
19084
|
return pid === void 0 ? void 0 : partitions[pid].fieldValues(docId, fieldPaths);
|
|
@@ -19123,7 +19137,7 @@ function createPartitionManager(indexName, initialConfig, initialLanguage, route
|
|
|
19123
19137
|
return vecIndexes;
|
|
19124
19138
|
},
|
|
19125
19139
|
resetVectorIndexes(newIndexes) {
|
|
19126
|
-
replaceVectorIndexes(vecIndexes, newIndexes,
|
|
19140
|
+
return replaceVectorIndexes(vecIndexes, newIndexes, afterSearchesRelease);
|
|
19127
19141
|
}
|
|
19128
19142
|
};
|
|
19129
19143
|
return manager;
|
|
@@ -19189,7 +19203,7 @@ var storageCode = codeLoader(async () => {
|
|
|
19189
19203
|
loadSegmentMerge(),
|
|
19190
19204
|
loadSuggestionStore(),
|
|
19191
19205
|
loadVectorCore(),
|
|
19192
|
-
import('./storage-leaf-
|
|
19206
|
+
import('./storage-leaf-N3JMQ6CF.mjs')
|
|
19193
19207
|
]);
|
|
19194
19208
|
code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
|
|
19195
19209
|
return code7;
|
|
@@ -19198,7 +19212,8 @@ var loadStorageCode = storageCode.load;
|
|
|
19198
19212
|
|
|
19199
19213
|
// src/engine/sync-epoch.ts
|
|
19200
19214
|
async function holdSyncEpochChange(core2, indexName) {
|
|
19201
|
-
|
|
19215
|
+
const entry = core2.indexRegistry.get(indexName);
|
|
19216
|
+
if (entry === void 0 || entry.sync === null && entry.changes === null) return () => void 0;
|
|
19202
19217
|
return (await loadStorageCode()).holdRenewedSyncEpoch(core2, indexName);
|
|
19203
19218
|
}
|
|
19204
19219
|
async function withRenewedSyncEpoch(core2, indexName, change) {
|
|
@@ -20473,12 +20488,30 @@ function vectorIndexesFor(indexName, config, copies, vectorStorage, onVectorGrap
|
|
|
20473
20488
|
}
|
|
20474
20489
|
function disposeEntry(entry) {
|
|
20475
20490
|
closeCopyPublicationOrder(entry.copyPublications);
|
|
20476
|
-
entry.manager.afterSearchesRelease(() => {
|
|
20477
|
-
|
|
20491
|
+
return entry.manager.afterSearchesRelease(() => {
|
|
20492
|
+
const disposals = [...entry.vectorIndexes.values()].map((vectorIndex) => vectorIndex.dispose());
|
|
20478
20493
|
closeHeldVectorCopies(entry.vectorCopies);
|
|
20479
20494
|
for (const partition of entry.manager.getAllPartitions()) partition.clear();
|
|
20495
|
+
return Promise.all(disposals).then(() => void 0);
|
|
20480
20496
|
});
|
|
20481
20497
|
}
|
|
20498
|
+
function createEntryBuilder(vectorStorage, onVectorGraphRepaired, pendingDisposals) {
|
|
20499
|
+
return (indexName, config, language, analysisStale, awaitedCopyLoad, copies, savedPartitionCount) => {
|
|
20500
|
+
const router = createPartitionRouter();
|
|
20501
|
+
const partitionCount = savedPartitionCount ?? config.partitions?.maxPartitions ?? 1;
|
|
20502
|
+
const vectorIndexes = vectorIndexesFor(indexName, config, copies, vectorStorage, onVectorGraphRepaired);
|
|
20503
|
+
const manager = createPartitionManager(
|
|
20504
|
+
indexName,
|
|
20505
|
+
config,
|
|
20506
|
+
language,
|
|
20507
|
+
router,
|
|
20508
|
+
partitionCount,
|
|
20509
|
+
vectorIndexes,
|
|
20510
|
+
pendingDisposals
|
|
20511
|
+
);
|
|
20512
|
+
return indexEntryOf(manager, vectorIndexes, analysisStale, awaitedCopyLoad);
|
|
20513
|
+
};
|
|
20514
|
+
}
|
|
20482
20515
|
function indexEntryOf(manager, vectorIndexes, analysisStale, awaitedCopyLoad) {
|
|
20483
20516
|
return {
|
|
20484
20517
|
manager,
|
|
@@ -20514,6 +20547,8 @@ function createDirectExecutor(options) {
|
|
|
20514
20547
|
const vectorWorkerCopies = options?.vectorWorkerCopies ?? NO_VECTOR_WORKER_COPIES;
|
|
20515
20548
|
const threadSlot = options?.threadSlot ?? 0;
|
|
20516
20549
|
const vectorStorage = options?.vectorStorage ?? "memory";
|
|
20550
|
+
const pendingDisposals = /* @__PURE__ */ new Map();
|
|
20551
|
+
const buildEntry = createEntryBuilder(vectorStorage, options?.onVectorGraphRepaired, pendingDisposals);
|
|
20517
20552
|
function requireIndex(indexName) {
|
|
20518
20553
|
const entry = indexes.get(indexName);
|
|
20519
20554
|
if (!entry) {
|
|
@@ -20547,21 +20582,15 @@ function createDirectExecutor(options) {
|
|
|
20547
20582
|
indexes.set(indexName, entry);
|
|
20548
20583
|
return entry.manager;
|
|
20549
20584
|
}
|
|
20550
|
-
function
|
|
20551
|
-
const
|
|
20552
|
-
const partitionCount = savedPartitionCount ?? config.partitions?.maxPartitions ?? 1;
|
|
20553
|
-
const vectorIndexes = vectorIndexesFor(indexName, config, copies, vectorStorage, options?.onVectorGraphRepaired);
|
|
20554
|
-
const manager = createPartitionManager(indexName, config, language, router, partitionCount, vectorIndexes);
|
|
20555
|
-
return indexEntryOf(manager, vectorIndexes, analysisStale, awaitedCopyLoad);
|
|
20556
|
-
}
|
|
20557
|
-
function dropIndex(indexName) {
|
|
20558
|
-
disposeEntry(requireIndex(indexName));
|
|
20585
|
+
async function dropIndex(indexName) {
|
|
20586
|
+
const entry = requireIndex(indexName);
|
|
20559
20587
|
indexes.delete(indexName);
|
|
20588
|
+
await disposeEntry(entry);
|
|
20560
20589
|
}
|
|
20561
|
-
function installDetachedIndex(detached) {
|
|
20590
|
+
async function installDetachedIndex(detached) {
|
|
20562
20591
|
const previous = indexes.get(detached.indexName);
|
|
20563
20592
|
indexes.set(detached.indexName, detached.entry);
|
|
20564
|
-
if (previous !== void 0 && previous !== detached.entry) disposeEntry(previous);
|
|
20593
|
+
if (previous !== void 0 && previous !== detached.entry) await disposeEntry(previous);
|
|
20565
20594
|
}
|
|
20566
20595
|
function listIndexes() {
|
|
20567
20596
|
return Array.from(indexes.keys());
|
|
@@ -20623,7 +20652,7 @@ function createDirectExecutor(options) {
|
|
|
20623
20652
|
options?.initializeCopyPublication?.(entry, action.publication, threadSlot);
|
|
20624
20653
|
}
|
|
20625
20654
|
} catch (err) {
|
|
20626
|
-
dropIndex(action.indexName);
|
|
20655
|
+
await dropIndex(action.indexName);
|
|
20627
20656
|
throw err;
|
|
20628
20657
|
}
|
|
20629
20658
|
return void 0;
|
|
@@ -20634,7 +20663,7 @@ function createDirectExecutor(options) {
|
|
|
20634
20663
|
return void 0;
|
|
20635
20664
|
}
|
|
20636
20665
|
case "dropIndex": {
|
|
20637
|
-
dropIndex(action.indexName);
|
|
20666
|
+
await dropIndex(action.indexName);
|
|
20638
20667
|
return void 0;
|
|
20639
20668
|
}
|
|
20640
20669
|
case "loadVectorCopy": {
|
|
@@ -20722,7 +20751,7 @@ function createDirectExecutor(options) {
|
|
|
20722
20751
|
case "clear": {
|
|
20723
20752
|
const entry = requireIndex(action.indexName);
|
|
20724
20753
|
entry.manager.clearPartitions();
|
|
20725
|
-
entry.manager.resetVectorIndexes(
|
|
20754
|
+
await entry.manager.resetVectorIndexes(
|
|
20726
20755
|
vectorIndexesFor(
|
|
20727
20756
|
action.indexName,
|
|
20728
20757
|
entry.config,
|
|
@@ -20760,6 +20789,7 @@ function createDirectExecutor(options) {
|
|
|
20760
20789
|
await entry.manager.publication.write(() => disposeEntry(entry));
|
|
20761
20790
|
}
|
|
20762
20791
|
indexes.clear();
|
|
20792
|
+
await Promise.all(pendingDisposals.keys());
|
|
20763
20793
|
return void 0;
|
|
20764
20794
|
}
|
|
20765
20795
|
}
|
|
@@ -21383,7 +21413,7 @@ function wireIndexState(wiring) {
|
|
|
21383
21413
|
} catch (error) {
|
|
21384
21414
|
await orchestrator.closeIndex(indexName).catch(() => void 0);
|
|
21385
21415
|
await durability.manager.unloadIndex(indexName).catch(() => void 0);
|
|
21386
|
-
if (executor.getManager(indexName) !== void 0) executor.dropIndex(indexName);
|
|
21416
|
+
if (executor.getManager(indexName) !== void 0) await executor.dropIndex(indexName);
|
|
21387
21417
|
throw error;
|
|
21388
21418
|
}
|
|
21389
21419
|
},
|
|
@@ -21401,7 +21431,7 @@ function wireIndexState(wiring) {
|
|
|
21401
21431
|
try {
|
|
21402
21432
|
await wiring.onClose?.(indexName);
|
|
21403
21433
|
} finally {
|
|
21404
|
-
if (executor.getManager(indexName) !== void 0) executor.dropIndex(indexName);
|
|
21434
|
+
if (executor.getManager(indexName) !== void 0) await executor.dropIndex(indexName);
|
|
21405
21435
|
const entry = indexRegistry.get(indexName);
|
|
21406
21436
|
if (entry !== void 0) {
|
|
21407
21437
|
entry.documentCount = documentCount;
|
|
@@ -21954,6 +21984,17 @@ function bm25Operations(core2) {
|
|
|
21954
21984
|
};
|
|
21955
21985
|
}
|
|
21956
21986
|
|
|
21987
|
+
// src/narsil/changes.ts
|
|
21988
|
+
function changesOperations(core2) {
|
|
21989
|
+
return {
|
|
21990
|
+
updateChanges: async (indexName, setting) => (await loadStorageCode()).updateChangesOf(core2, indexName, setting),
|
|
21991
|
+
getChanges: async (indexName) => (await loadStorageCode()).changesOf(core2, indexName),
|
|
21992
|
+
async *followChanges(indexName, options) {
|
|
21993
|
+
yield* (await loadStorageCode()).followIndexChanges(core2, indexName, options);
|
|
21994
|
+
}
|
|
21995
|
+
};
|
|
21996
|
+
}
|
|
21997
|
+
|
|
21957
21998
|
// src/narsil/internals.ts
|
|
21958
21999
|
var engineCores = /* @__PURE__ */ new WeakMap();
|
|
21959
22000
|
var queryReadOptions = /* @__PURE__ */ new WeakMap();
|
|
@@ -21969,16 +22010,6 @@ function engineCoreOf(engine) {
|
|
|
21969
22010
|
|
|
21970
22011
|
// src/narsil/portability.ts
|
|
21971
22012
|
function portabilityOperations(core2, config, engine) {
|
|
21972
|
-
async function withOpenIndex2(indexName, action) {
|
|
21973
|
-
core2.guardShutdown();
|
|
21974
|
-
core2.requireIndex(indexName);
|
|
21975
|
-
const release = await core2.indexState.acquire(indexName);
|
|
21976
|
-
try {
|
|
21977
|
-
return await action();
|
|
21978
|
-
} finally {
|
|
21979
|
-
release();
|
|
21980
|
-
}
|
|
21981
|
-
}
|
|
21982
22013
|
function queueRestore(indexName, data) {
|
|
21983
22014
|
const { restoresInFlight } = core2;
|
|
21984
22015
|
const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
|
|
@@ -22013,7 +22044,7 @@ function portabilityOperations(core2, config, engine) {
|
|
|
22013
22044
|
}
|
|
22014
22045
|
return {
|
|
22015
22046
|
snapshot(indexName, options) {
|
|
22016
|
-
return
|
|
22047
|
+
return withOpenIndex(core2, indexName, async () => {
|
|
22017
22048
|
const { createSnapshot } = await loadStorageCode();
|
|
22018
22049
|
return createSnapshot(snapshotDepsOf(indexName), options?.queryHistory === true ? core2 : null);
|
|
22019
22050
|
});
|
|
@@ -22025,10 +22056,9 @@ function portabilityOperations(core2, config, engine) {
|
|
|
22025
22056
|
core2.heapPressureNotifier.check(indexName);
|
|
22026
22057
|
},
|
|
22027
22058
|
exportDocuments(indexName) {
|
|
22028
|
-
return
|
|
22029
|
-
const {
|
|
22030
|
-
|
|
22031
|
-
return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
|
|
22059
|
+
return withOpenIndex(core2, indexName, async () => {
|
|
22060
|
+
const { openDocumentExport } = await loadStorageCode();
|
|
22061
|
+
return openDocumentExport(core2, snapshotDepsOf(indexName));
|
|
22032
22062
|
});
|
|
22033
22063
|
},
|
|
22034
22064
|
importDocumentExport(indexName, data) {
|
|
@@ -22903,6 +22933,7 @@ async function queryUnderHold(core2, indexName, params, resolvedParams, embedded
|
|
|
22903
22933
|
options?.onRanked?.(manager, result);
|
|
22904
22934
|
return result;
|
|
22905
22935
|
} catch (error) {
|
|
22936
|
+
if (error instanceof NarsilError && error.code === ErrorCodes.RERANK_FAILED) throw error;
|
|
22906
22937
|
if (runner?.replaced) return INDEX_REPLACED_DURING_RERANK;
|
|
22907
22938
|
throw error;
|
|
22908
22939
|
} finally {
|
|
@@ -23251,6 +23282,7 @@ function createNarsilFromCore(core2, config) {
|
|
|
23251
23282
|
...synonymOperations(core2),
|
|
23252
23283
|
...bm25Operations(core2),
|
|
23253
23284
|
...syncOperations(core2),
|
|
23285
|
+
...changesOperations(core2),
|
|
23254
23286
|
async checkpoint(indexName) {
|
|
23255
23287
|
guardShutdown();
|
|
23256
23288
|
requireIndex(indexName);
|
|
@@ -39,6 +39,13 @@ var ErrorCodes = {
|
|
|
39
39
|
SYNC_NOT_READY: "SYNC_NOT_READY",
|
|
40
40
|
SYNC_NOT_ENABLED: "SYNC_NOT_ENABLED",
|
|
41
41
|
SYNC_SNAPSHOT_PREPARING: "SYNC_SNAPSHOT_PREPARING",
|
|
42
|
+
CHANGES_DURABILITY_REQUIRED: "CHANGES_DURABILITY_REQUIRED",
|
|
43
|
+
CHANGES_BACKUP_STORE_REQUIRED: "CHANGES_BACKUP_STORE_REQUIRED",
|
|
44
|
+
CHANGES_NOT_READY: "CHANGES_NOT_READY",
|
|
45
|
+
CHANGES_NOT_ENABLED: "CHANGES_NOT_ENABLED",
|
|
46
|
+
CHANGES_PREVIOUS_DOCUMENT_REQUIRED: "CHANGES_PREVIOUS_DOCUMENT_REQUIRED",
|
|
47
|
+
CHANGES_EXPORT_PREPARING: "CHANGES_EXPORT_PREPARING",
|
|
48
|
+
CHANGES_INVALID_POSITIONS: "CHANGES_INVALID_POSITIONS",
|
|
42
49
|
QUERY_SUGGESTIONS_NOT_ENABLED: "QUERY_SUGGESTIONS_NOT_ENABLED",
|
|
43
50
|
SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD",
|
|
44
51
|
VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH",
|
|
@@ -2661,6 +2661,9 @@ function createVectorStore(options) {
|
|
|
2661
2661
|
},
|
|
2662
2662
|
growthBytesFor(vectors) {
|
|
2663
2663
|
return state.open === null ? 0 : growthBytesFor(state.open, vectors);
|
|
2664
|
+
},
|
|
2665
|
+
visitDocumentTables(visit) {
|
|
2666
|
+
visit("documents", docToOrd.size, true);
|
|
2664
2667
|
}
|
|
2665
2668
|
};
|
|
2666
2669
|
}
|
|
@@ -4329,6 +4332,7 @@ function cancelColdHold(state) {
|
|
|
4329
4332
|
const hold = state.cold;
|
|
4330
4333
|
if (hold === null) return;
|
|
4331
4334
|
state.cold = null;
|
|
4335
|
+
hold.loadWanted();
|
|
4332
4336
|
hold.field.close();
|
|
4333
4337
|
}
|
|
4334
4338
|
function openColdField(state, field, load) {
|
|
@@ -4344,7 +4348,7 @@ function openColdField(state, field, load) {
|
|
|
4344
4348
|
loadWanted = resolve;
|
|
4345
4349
|
});
|
|
4346
4350
|
const hold = beginColdHold(state, field, loaded, loadWanted);
|
|
4347
|
-
|
|
4351
|
+
const settled = load(
|
|
4348
4352
|
(shape) => beginCheckpointRestore(state, shape),
|
|
4349
4353
|
() => state.cold === hold,
|
|
4350
4354
|
loadingWanted
|
|
@@ -4352,6 +4356,7 @@ function openColdField(state, field, load) {
|
|
|
4352
4356
|
if (state.cold === hold) endColdHold(state);
|
|
4353
4357
|
}).then(finished, failed);
|
|
4354
4358
|
loaded.catch(() => void 0);
|
|
4359
|
+
return settled;
|
|
4355
4360
|
}
|
|
4356
4361
|
function coldHas(hold, docId) {
|
|
4357
4362
|
if (hold.written.has(docId)) return true;
|
|
@@ -4698,6 +4703,10 @@ var FlaggedDocuments = class {
|
|
|
4698
4703
|
Atomics.store(handles.header, this.layout.countWord, this.members.size + this.retired.size);
|
|
4699
4704
|
return held;
|
|
4700
4705
|
}
|
|
4706
|
+
visitTables(name, visit) {
|
|
4707
|
+
visit(name, this.members.size, false);
|
|
4708
|
+
visit(`${name}-ordinals`, this.ordinals.size, false);
|
|
4709
|
+
}
|
|
4701
4710
|
publishCount(handles) {
|
|
4702
4711
|
Atomics.store(handles.header, this.layout.countWord, this.members.size + this.retired.size);
|
|
4703
4712
|
}
|
|
@@ -4748,6 +4757,9 @@ function createRemovedDocuments(store) {
|
|
|
4748
4757
|
keepsRetiredFlags: false
|
|
4749
4758
|
});
|
|
4750
4759
|
}
|
|
4760
|
+
function visitFlaggedTables(name, documents, visit) {
|
|
4761
|
+
if (documents instanceof FlaggedDocuments) documents.visitTables(name, visit);
|
|
4762
|
+
}
|
|
4751
4763
|
|
|
4752
4764
|
// src/vector/vector-index/maintenance.ts
|
|
4753
4765
|
function compact(state) {
|
|
@@ -5579,6 +5591,12 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
5579
5591
|
return state.store.has(docId) && !state.tombstones.has(docId);
|
|
5580
5592
|
}
|
|
5581
5593
|
const whenLoaded = () => untilColdLoaded(state);
|
|
5594
|
+
const coldLoadsInFlight = /* @__PURE__ */ new Set();
|
|
5595
|
+
function openColdFieldTracked(field, load) {
|
|
5596
|
+
const settled = openColdField(state, field, load);
|
|
5597
|
+
coldLoadsInFlight.add(settled);
|
|
5598
|
+
void settled.then(() => coldLoadsInFlight.delete(settled));
|
|
5599
|
+
}
|
|
5582
5600
|
async function searchParallel(query, k, options) {
|
|
5583
5601
|
if (state.graphsHeldOffThread !== null) await untilGraphReleased(state);
|
|
5584
5602
|
if (state.cold !== null) return coldSearchConcurrently(state, state.cold, query, k, options);
|
|
@@ -5662,7 +5680,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
5662
5680
|
},
|
|
5663
5681
|
dispose: () => {
|
|
5664
5682
|
cancelColdHold(state);
|
|
5665
|
-
return disposeIndex(state).then(closeIdleTurnHop);
|
|
5683
|
+
return Promise.all([disposeIndex(state), ...coldLoadsInFlight]).then(closeIdleTurnHop);
|
|
5666
5684
|
},
|
|
5667
5685
|
search: withGraphFree(
|
|
5668
5686
|
state,
|
|
@@ -5688,6 +5706,11 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
5688
5706
|
maintenanceStatus: () => ({ ...maintenanceStatus(state), loadingFromFiles: state.cold !== null }),
|
|
5689
5707
|
estimateMemoryBytes: () => estimateMemoryBytes(state) + (state.cold?.field.residentBytes ?? 0),
|
|
5690
5708
|
growthBytesFor: (vectors) => state.store.growthBytesFor(vectors),
|
|
5709
|
+
visitDocumentTables: (visit) => {
|
|
5710
|
+
state.store.visitDocumentTables(visit);
|
|
5711
|
+
visitFlaggedTables("removed", state.tombstones, visit);
|
|
5712
|
+
visitFlaggedTables("unplaced", state.buffer, visit);
|
|
5713
|
+
},
|
|
5691
5714
|
deserialize: withGraphFree(state, (parts) => {
|
|
5692
5715
|
cancelColdHold(state);
|
|
5693
5716
|
invalidateWorkerCopies(state);
|
|
@@ -5706,7 +5729,7 @@ function createVectorIndex(fieldName, dimension, config, workerCopies = VECTOR_W
|
|
|
5706
5729
|
invalidateWorkerCopies(state);
|
|
5707
5730
|
return beginCheckpointRestore(state, shape);
|
|
5708
5731
|
}),
|
|
5709
|
-
openColdField:
|
|
5732
|
+
openColdField: openColdFieldTracked,
|
|
5710
5733
|
startShuffledRebuildWhenDue: () => {
|
|
5711
5734
|
if (state.cold === null) startShuffledRebuild(state);
|
|
5712
5735
|
},
|
|
@@ -1840,14 +1840,27 @@ function applyStoredIndexBm25(core, indexName, load) {
|
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
1842
|
// src/engine/sync-state.ts
|
|
1843
|
-
function
|
|
1844
|
-
|
|
1845
|
-
const
|
|
1843
|
+
function epochStatesOfMetadata(metadata) {
|
|
1844
|
+
const syncOn = metadata.sync?.enabled === true;
|
|
1845
|
+
const changesOn = metadata.changes?.enabled === true;
|
|
1846
|
+
if (!syncOn && !changesOn) return { sync: null, changes: null };
|
|
1847
|
+
const stored = isSyncEpoch(metadata.syncEpoch) ? metadata.syncEpoch : null;
|
|
1848
|
+
const epoch = stored ?? newSyncEpoch();
|
|
1849
|
+
const sync = metadata.sync;
|
|
1850
|
+
const changes = metadata.changes;
|
|
1846
1851
|
return {
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1852
|
+
sync: syncOn && sync !== void 0 ? {
|
|
1853
|
+
...sync.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: sync.historyMaxAgeMs } : {},
|
|
1854
|
+
...sync.historyMaxBytes !== void 0 ? { historyMaxBytes: sync.historyMaxBytes } : {},
|
|
1855
|
+
active: stored !== null && metadata.syncActive === true,
|
|
1856
|
+
epoch
|
|
1857
|
+
} : null,
|
|
1858
|
+
changes: changesOn && changes !== void 0 ? {
|
|
1859
|
+
previousDocument: changes.previousDocument === true,
|
|
1860
|
+
...changes.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: changes.historyMaxAgeMs } : {},
|
|
1861
|
+
...changes.historyMaxBytes !== void 0 ? { historyMaxBytes: changes.historyMaxBytes } : {},
|
|
1862
|
+
epoch
|
|
1863
|
+
} : null
|
|
1851
1864
|
};
|
|
1852
1865
|
}
|
|
1853
1866
|
|
|
@@ -1974,7 +1987,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
|
|
|
1974
1987
|
analysisGeneration: metadata.analysisGeneration ?? 0,
|
|
1975
1988
|
pendingAnalysis: metadata.pendingAnalysis ?? null,
|
|
1976
1989
|
durableAnalysis: null,
|
|
1977
|
-
|
|
1990
|
+
...epochStatesOfMetadata(metadata),
|
|
1978
1991
|
querySuggestions: metadata.querySuggestions ?? null
|
|
1979
1992
|
});
|
|
1980
1993
|
if (loadData) await deps.indexState().registerOpen(metadata.indexName);
|