@delali/narsil 0.4.1 → 0.4.2-next.273
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 -1
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +9 -3
- package/dist/adapters/gcs.d.ts +1 -1
- package/dist/adapters/indexeddb.d.ts +6 -1
- package/dist/adapters/indexeddb.mjs +20 -26
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/s3.d.ts +1 -1
- package/dist/{adapters-pljAqmrC.d.ts → adapters-8LcdNB77.d.ts} +18 -1
- package/dist/browser/{chunk-QAOVAYAG.mjs → chunk-56UNHLAF.mjs} +1 -1
- package/dist/browser/{chunk-GBJSEHVJ.mjs → chunk-EKISQBV2.mjs} +283 -244
- package/dist/browser/{chunk-YINZFPLT.mjs → chunk-VAPCFSMX.mjs} +1 -1
- package/dist/browser/{chunk-4E5APHTM.mjs → chunk-VIVG3OXM.mjs} +1 -1
- package/dist/browser/{durability-config-75NSFCQN.mjs → durability-config-UP3OTUMB.mjs} +34 -2
- package/dist/browser/{msgpack-leaf-44XNWSSY.mjs → msgpack-leaf-76Q5SZ5S.mjs} +23 -10
- package/dist/browser/{optional-reads-6LN3HMUH.mjs → optional-reads-NQO5DKM4.mjs} +18 -16
- package/dist/browser/{optional-writes-76DWMRQH.mjs → optional-writes-3HKIVZFU.mjs} +295 -106
- package/dist/browser/{segment-codec-leaf-A427QJUX.mjs → segment-codec-leaf-GXSRX5VT.mjs} +47 -30
- package/dist/browser/{storage-leaf-5UTR5K7J.mjs → storage-leaf-42IZEOJJ.mjs} +1473 -305
- package/dist/{capabilities-BOFFMx84.d.ts → capabilities-BoWiLNv7.d.ts} +76 -61
- package/dist/{chunk-Z7XSHKOF.mjs → chunk-35RWLUVY.mjs} +63 -144
- package/dist/{chunk-6GHX35ZM.mjs → chunk-43T3P3BE.mjs} +1 -1
- package/dist/{chunk-IL5DRCNU.mjs → chunk-4JLHHEBN.mjs} +1 -1
- package/dist/{chunk-DKIMHIBC.mjs → chunk-4YIVY3PB.mjs} +2 -2
- package/dist/{react-native/chunks/chunk-ZUJCUPVS.mjs → chunk-5SHWA6PE.mjs} +1 -1
- package/dist/{chunk-2K24MEYV.mjs → chunk-6LVQ3GLT.mjs} +3 -3
- package/dist/{chunk-DDUXEJXW.mjs → chunk-6SIEVWMG.mjs} +45 -22
- package/dist/{chunk-WM5KJSQV.mjs → chunk-ACNHJOGC.mjs} +1 -1
- package/dist/{chunk-755NM4PL.mjs → chunk-BWPVDIRN.mjs} +183 -21
- package/dist/{chunk-SMQPZHPS.mjs → chunk-C57GWAXN.mjs} +1 -1
- package/dist/{chunk-357KIU5E.mjs → chunk-DRZP5MSG.mjs} +5 -5
- package/dist/{chunk-MYN4K5IS.mjs → chunk-DZMD4OMD.mjs} +1 -1
- package/dist/{chunk-7P5YWDRQ.mjs → chunk-EY5U4P5V.mjs} +1 -1
- package/dist/{chunk-X3EQCQLP.mjs → chunk-EZJ6HBG7.mjs} +2 -2
- package/dist/{chunk-WC5KAWXQ.mjs → chunk-FE2XILWN.mjs} +4 -4
- package/dist/{chunk-CERPUGRK.mjs → chunk-G3KVEHIW.mjs} +2 -2
- package/dist/{chunk-B3MO37YF.mjs → chunk-GTGQLCEI.mjs} +1 -1
- package/dist/{chunk-MSJD74GN.mjs → chunk-H23FB267.mjs} +5 -5
- package/dist/{chunk-UNEEFTEU.mjs → chunk-HZ3OAUTL.mjs} +2 -1
- package/dist/{chunk-M3B7SGJB.mjs → chunk-KL4ORYJW.mjs} +6 -6
- package/dist/{chunk-WTMCGZ74.mjs → chunk-KXA77DPZ.mjs} +2 -2
- package/dist/{chunk-6I6OO6B2.mjs → chunk-LRIJ7U3T.mjs} +4 -4
- package/dist/{chunk-3IE3A74H.mjs → chunk-PNFP5THV.mjs} +3 -3
- package/dist/{react-native/chunks/chunk-4FUCRLSA.mjs → chunk-PQWK7KXS.mjs} +1 -1
- package/dist/{chunk-P4F4UWLC.mjs → chunk-PSO7V7VW.mjs} +17 -3
- package/dist/{chunk-OGYSPNL2.mjs → chunk-QNZJYMCF.mjs} +7 -7
- package/dist/{chunk-DBC4EJWB.mjs → chunk-R3PFPFME.mjs} +1 -1
- package/dist/{chunk-MSIN4NM3.mjs → chunk-S3JHYPH7.mjs} +6 -1
- package/dist/{chunk-MI6UZGUR.mjs → chunk-SPA7GXST.mjs} +3 -3
- package/dist/{chunk-PP3W5PQQ.mjs → chunk-WYH3QHBK.mjs} +698 -451
- package/dist/{chunk-D456ZFPQ.mjs → chunk-X5V25BPN.mjs} +2 -2
- package/dist/{chunk-GXCDWLQI.mjs → chunk-Y7GXGJFZ.mjs} +23 -10
- package/dist/{chunk-NCIGNQJE.mjs → chunk-YGRJLI2Z.mjs} +930 -387
- package/dist/{react-native/chunks/chunk-MMPBO4WR.mjs → chunk-ZO7VLAIT.mjs} +2 -2
- package/dist/{chunk-AXDB6KUQ.mjs → chunk-ZTB7AWTW.mjs} +4 -4
- package/dist/chunk-ZYEEOZTT.mjs +52 -0
- package/dist/{client-BhNxHtcZ.d.ts → client-B0NPZSKY.d.ts} +4 -4
- package/dist/client.d.ts +9 -9
- package/dist/client.mjs +2 -2
- package/dist/{config-P9zW3Zz7.d.ts → config-B3-sw887.d.ts} +3 -3
- package/dist/{config-BJSL7piq.d.ts → config-DL_nkguq.d.ts} +4 -4
- package/dist/{direct-executor-GWJXDFLD.mjs → direct-executor-7G57AYXH.mjs} +4 -4
- package/dist/distribution/coordinator/etcd.d.ts +3 -3
- package/dist/distribution/coordinator/etcd.mjs +33 -3
- package/dist/distribution/coordinator/in-memory.d.ts +3 -3
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +1 -1
- package/dist/distribution/transport/tcp.mjs +12 -7
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +167 -91
- package/dist/{durability-config-VWS2K24E.mjs → durability-config-HWKWP35M.mjs} +34 -2
- package/dist/embeddings/openai.d.ts +7 -3
- package/dist/embeddings/openai.mjs +37 -31
- package/dist/{engine-DoFnkRoF.d.ts → engine-DGG_yX0p.d.ts} +3 -3
- package/dist/{index-B_vmxpgW.d.ts → index-fX_FbuRT.d.ts} +1 -1
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/index.react-native.mjs +4 -4
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/{long-query-thread-GNTDYDOZ.mjs → long-query-thread-KPN7NSOC.mjs} +14 -14
- package/dist/msgpack-leaf-LIT7TKZW.mjs +9 -0
- package/dist/{optional-reads-UCS23AWP.mjs → optional-reads-ESDVS225.mjs} +18 -16
- package/dist/{optional-writes-2AHJCGTY.mjs → optional-writes-CSULLISE.mjs} +9 -8
- package/dist/{paged-partition-archive-GBAHDT55.mjs → paged-partition-archive-BKQADXOT.mjs} +13 -13
- package/dist/partial-words.browser.mjs +3 -3
- package/dist/partial-words.mjs +4 -4
- package/dist/pattern.browser.mjs +2 -2
- package/dist/pattern.mjs +2 -2
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +14 -14
- package/dist/{query-actions-IDCUA7UV.mjs → query-actions-HTSJKZRU.mjs} +4 -4
- package/dist/query-suggestions/merge-worker.mjs +7 -7
- package/dist/query-suggestions.browser.mjs +3 -3
- package/dist/query-suggestions.d.ts +3 -3
- package/dist/query-suggestions.mjs +5 -5
- package/dist/react-native/chunks/{chunk-MRH36RN3.mjs → chunk-AOLLV37A.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-UO44MA5M.mjs → chunk-DN4FT62B.mjs} +23 -10
- package/dist/react-native/chunks/{chunk-TG56N5JC.mjs → chunk-EF4Y5C3Y.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-HTBY4GON.mjs → chunk-ESVBC3AT.mjs} +1 -1
- package/dist/{chunk-F26DOOUH.mjs → react-native/chunks/chunk-H6LK5WCF.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-LPX26NNL.mjs → chunk-JEYZQA4Z.mjs} +699 -451
- package/dist/react-native/chunks/{chunk-AJAH6X7W.mjs → chunk-KJQ3BUVM.mjs} +4 -4
- package/dist/{chunk-UHLFCGZ3.mjs → react-native/chunks/chunk-QYVRD6C5.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-SCGBU47K.mjs → chunk-X3VY2YT4.mjs} +2 -2
- package/dist/{chunk-R2PJKSNL.mjs → react-native/chunks/chunk-ZF3VSGEI.mjs} +1 -1
- package/dist/react-native/chunks/{durability-config-FCSD4MXY.mjs → durability-config-HJETGZVB.mjs} +34 -2
- package/dist/react-native/chunks/msgpack-leaf-FOUPTT7J.mjs +7 -0
- package/dist/react-native/chunks/{optional-reads-4XCJ34QG.mjs → optional-reads-TN3PT6M4.mjs} +18 -16
- package/dist/react-native/chunks/{optional-writes-XYZVTBFB.mjs → optional-writes-MGFFGKYQ.mjs} +8 -7
- package/dist/react-native/chunks/{restore-queue-NOKQZJ2Z.mjs → restore-queue-MVJTP3E4.mjs} +7 -7
- package/dist/react-native/chunks/{segment-codec-leaf-3ZXBJVKH.mjs → segment-codec-leaf-PSWHL55A.mjs} +5 -5
- package/dist/react-native/chunks/{segment-merge-leaf-3Z7MMPWE.mjs → segment-merge-leaf-WOJWSDLW.mjs} +6 -6
- package/dist/react-native/chunks/{storage-leaf-KJOX3MMW.mjs → storage-leaf-ZUN6Y44X.mjs} +1481 -314
- package/dist/react-native/chunks/{store-leaf-QGLVSO5X.mjs → store-leaf-K5XG46FV.mjs} +6 -6
- package/dist/react-native/chunks/{suggestions-leaf-6GI5ZSW6.mjs → suggestions-leaf-KDPM3P27.mjs} +6 -6
- package/dist/react-native/chunks/{worker-copies-ALOD7TSP.mjs → worker-copies-FVFMBBH6.mjs} +5 -5
- package/dist/react-native/partial-words.mjs +4 -4
- package/dist/react-native/pattern.mjs +2 -2
- package/dist/react-native/query-suggestions.mjs +4 -4
- package/dist/react-native/sync.mjs +4 -4
- package/dist/react-native/synonyms.mjs +4 -4
- package/dist/react.d.ts +10 -10
- package/dist/react.mjs +0 -2
- package/dist/{rerank-HB6DU6GS.mjs → rerank-3QEJNMFH.mjs} +4 -4
- package/dist/rerankers/http.d.ts +1 -1
- package/dist/rerankers/http.mjs +19 -15
- package/dist/{restore-queue-VUQHGCXE.mjs → restore-queue-Q76Q4S35.mjs} +7 -7
- package/dist/{schema-CzG9OUw5.d.ts → schema-CFnQ-WI3.d.ts} +1 -1
- package/dist/{segment-codec-leaf-TW2FPAAT.mjs → segment-codec-leaf-BSDDR7DQ.mjs} +5 -5
- package/dist/{segment-merge-leaf-BS3QV5PZ.mjs → segment-merge-leaf-6TT66HC5.mjs} +5 -5
- package/dist/server.d.ts +86 -12
- package/dist/server.mjs +2243 -1918
- package/dist/{storage-leaf-5IG2HPNY.mjs → storage-leaf-R5JQ2X2M.mjs} +1193 -219
- package/dist/{store-leaf-ZWSOK2DV.mjs → store-leaf-NCGETZYY.mjs} +6 -6
- package/dist/{suggestions-leaf-MUZNKQVF.mjs → suggestions-leaf-TX3GTD6S.mjs} +8 -8
- package/dist/sync/filesystem.d.ts +4 -4
- package/dist/sync/filesystem.mjs +12 -12
- package/dist/sync/indexeddb.browser.mjs +1 -1
- package/dist/sync/indexeddb.d.ts +4 -4
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +4 -4
- package/dist/sync.d.ts +5 -5
- package/dist/sync.mjs +4 -4
- package/dist/synonyms.browser.mjs +3 -3
- package/dist/synonyms.mjs +4 -4
- package/dist/{tasks-DrLiolTG.d.ts → tasks-B2MDjPL0.d.ts} +4 -4
- package/dist/{thread-6ZBCENAP.mjs → thread-VLVPAUWC.mjs} +13 -13
- package/dist/{types-pS-mAJmX.d.ts → types-DGjk684l.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +2 -2
- package/dist/{worker-copies-32HWFUH7.mjs → worker-copies-NZSBQZKG.mjs} +7 -7
- package/dist/workers/entry.mjs +16 -16
- package/package.json +12 -12
- package/dist/chunk-HLPRHOSO.mjs +0 -17
- package/dist/msgpack-leaf-H5ZYW7S7.mjs +0 -9
- package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +0 -7
|
@@ -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, 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-
|
|
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-56UNHLAF.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, 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-
|
|
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-VAPCFSMX.mjs';
|
|
4
4
|
|
|
5
5
|
// src/analysis/registry.ts
|
|
6
6
|
var tokenizers = /* @__PURE__ */ new Map();
|
|
@@ -11511,11 +11511,13 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
|
|
|
11511
11511
|
isTombstoned: (ordinal) => tombstones.has(ordinal),
|
|
11512
11512
|
settleRemovals: counts.settleRemovals
|
|
11513
11513
|
});
|
|
11514
|
-
const
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11514
|
+
const textFieldsOnly = {
|
|
11515
|
+
kind: "fields",
|
|
11516
|
+
include: source.fieldLengthNames.map((fieldPath) => fieldPath.split(".")),
|
|
11517
|
+
exclude: []
|
|
11518
11518
|
};
|
|
11519
|
+
const textAt2 = (ordinal) => documentSource.readAt(ordinal, textFieldsOnly);
|
|
11520
|
+
const textDocuments = { count: documentSource.count, textFields: source.fieldLengthNames, documentAt: textAt2 };
|
|
11519
11521
|
const loadSurfaceForms = survivingSurfaceForms === void 0 ? source.readSurfaceForms : () => survivingSurfaceForms;
|
|
11520
11522
|
const surfaces = createFrozenSurfaceSlot(
|
|
11521
11523
|
loadSurfaceForms,
|
|
@@ -11587,7 +11589,7 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
|
|
|
11587
11589
|
source.fieldNames,
|
|
11588
11590
|
source.fieldLengthNames,
|
|
11589
11591
|
ordinal,
|
|
11590
|
-
|
|
11592
|
+
textAt2(ordinal),
|
|
11591
11593
|
analysis,
|
|
11592
11594
|
surfaces,
|
|
11593
11595
|
partialWords
|
|
@@ -12379,7 +12381,7 @@ function segmentsHostPart() {
|
|
|
12379
12381
|
|
|
12380
12382
|
// src/core/segment-codec-code.ts
|
|
12381
12383
|
var segmentCodec = codeLoader(async () => {
|
|
12382
|
-
const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-
|
|
12384
|
+
const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-GXSRX5VT.mjs')]);
|
|
12383
12385
|
code7.bindSegmentCodecHost(optionalCodeHost(), msgpack);
|
|
12384
12386
|
return code7;
|
|
12385
12387
|
}, "segment codec");
|
|
@@ -12387,7 +12389,7 @@ var loadSegmentCodec = segmentCodec.load;
|
|
|
12387
12389
|
|
|
12388
12390
|
// src/engine/optional-writes-code.ts
|
|
12389
12391
|
var optionalWrites = codeLoader(async () => {
|
|
12390
|
-
const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-
|
|
12392
|
+
const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-3HKIVZFU.mjs')]);
|
|
12391
12393
|
code7.bindOptionalWritesHost(optionalCodeHost(), segmentCodec2);
|
|
12392
12394
|
return code7;
|
|
12393
12395
|
}, "write");
|
|
@@ -15023,6 +15025,177 @@ function mergeGroupComponents(components, internalId, contribution) {
|
|
|
15023
15025
|
});
|
|
15024
15026
|
}
|
|
15025
15027
|
|
|
15028
|
+
// src/core/partition/top-k-heap.ts
|
|
15029
|
+
function candidateWorse(a, b) {
|
|
15030
|
+
if (a.score < b.score) return true;
|
|
15031
|
+
if (a.score > b.score) return false;
|
|
15032
|
+
return unorderedCandidateWorse(a, b);
|
|
15033
|
+
}
|
|
15034
|
+
function unorderedCandidateWorse(a, b) {
|
|
15035
|
+
return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
|
|
15036
|
+
}
|
|
15037
|
+
function buildMinHeap(heap) {
|
|
15038
|
+
for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
|
|
15039
|
+
siftDown(heap, index);
|
|
15040
|
+
}
|
|
15041
|
+
}
|
|
15042
|
+
function siftDown(heap, start) {
|
|
15043
|
+
const len = heap.length;
|
|
15044
|
+
let current = start;
|
|
15045
|
+
for (; ; ) {
|
|
15046
|
+
let worst = current;
|
|
15047
|
+
const left = 2 * current + 1;
|
|
15048
|
+
const right = 2 * current + 2;
|
|
15049
|
+
if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
|
|
15050
|
+
if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
|
|
15051
|
+
if (worst === current) break;
|
|
15052
|
+
const held = heap[current];
|
|
15053
|
+
heap[current] = heap[worst];
|
|
15054
|
+
heap[worst] = held;
|
|
15055
|
+
current = worst;
|
|
15056
|
+
}
|
|
15057
|
+
}
|
|
15058
|
+
function sortSelection(heap) {
|
|
15059
|
+
heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
|
|
15060
|
+
}
|
|
15061
|
+
|
|
15062
|
+
// src/core/partition/score-buffer.ts
|
|
15063
|
+
var MAX_GENERATION = 2147483647;
|
|
15064
|
+
function createScoreBuffer(capacity) {
|
|
15065
|
+
return {
|
|
15066
|
+
scores: new Float64Array(capacity),
|
|
15067
|
+
stamps: new Int32Array(capacity),
|
|
15068
|
+
touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
|
|
15069
|
+
touchedCount: 0,
|
|
15070
|
+
generation: 0
|
|
15071
|
+
};
|
|
15072
|
+
}
|
|
15073
|
+
function beginScoring(buffer, capacity) {
|
|
15074
|
+
if (buffer.scores.length < capacity) {
|
|
15075
|
+
buffer.scores = new Float64Array(capacity);
|
|
15076
|
+
buffer.stamps = new Int32Array(capacity);
|
|
15077
|
+
buffer.generation = 0;
|
|
15078
|
+
}
|
|
15079
|
+
if (buffer.generation >= MAX_GENERATION) {
|
|
15080
|
+
buffer.stamps.fill(0);
|
|
15081
|
+
buffer.generation = 0;
|
|
15082
|
+
}
|
|
15083
|
+
buffer.generation++;
|
|
15084
|
+
buffer.touchedCount = 0;
|
|
15085
|
+
}
|
|
15086
|
+
function appendTouched(buffer, internalId) {
|
|
15087
|
+
if (buffer.touchedCount === buffer.touched.length) {
|
|
15088
|
+
const grown2 = new Int32Array(buffer.touched.length * 2);
|
|
15089
|
+
grown2.set(buffer.touched);
|
|
15090
|
+
buffer.touched = grown2;
|
|
15091
|
+
}
|
|
15092
|
+
buffer.touched[buffer.touchedCount] = internalId;
|
|
15093
|
+
buffer.touchedCount++;
|
|
15094
|
+
}
|
|
15095
|
+
function addScore(buffer, internalId, termScore) {
|
|
15096
|
+
if (buffer.stamps[internalId] === buffer.generation) {
|
|
15097
|
+
buffer.scores[internalId] += termScore;
|
|
15098
|
+
return;
|
|
15099
|
+
}
|
|
15100
|
+
buffer.stamps[internalId] = buffer.generation;
|
|
15101
|
+
buffer.scores[internalId] = termScore;
|
|
15102
|
+
appendTouched(buffer, internalId);
|
|
15103
|
+
}
|
|
15104
|
+
function markCounted(buffer, internalId) {
|
|
15105
|
+
const countedStamp = -buffer.generation;
|
|
15106
|
+
const stamp = buffer.stamps[internalId];
|
|
15107
|
+
if (stamp === buffer.generation || stamp === countedStamp) return false;
|
|
15108
|
+
buffer.stamps[internalId] = countedStamp;
|
|
15109
|
+
return true;
|
|
15110
|
+
}
|
|
15111
|
+
function kthBestScore(buffer, selection, resolver) {
|
|
15112
|
+
const wanted = selection.length;
|
|
15113
|
+
const { touched, touchedCount, scores } = buffer;
|
|
15114
|
+
let size = 0;
|
|
15115
|
+
let unordered = 0;
|
|
15116
|
+
for (let index = 0; index < touchedCount; index++) {
|
|
15117
|
+
const internalId = touched[index];
|
|
15118
|
+
const score = scores[internalId];
|
|
15119
|
+
if (size === wanted && !(score > selection[0])) continue;
|
|
15120
|
+
if (!resolver.isLive(internalId)) continue;
|
|
15121
|
+
let at = 0;
|
|
15122
|
+
if (size < wanted) {
|
|
15123
|
+
if (Number.isNaN(score)) {
|
|
15124
|
+
unordered++;
|
|
15125
|
+
continue;
|
|
15126
|
+
}
|
|
15127
|
+
at = size++;
|
|
15128
|
+
while (at > 0) {
|
|
15129
|
+
const parent = at - 1 >> 1;
|
|
15130
|
+
if (selection[parent] <= score) break;
|
|
15131
|
+
selection[at] = selection[parent];
|
|
15132
|
+
at = parent;
|
|
15133
|
+
}
|
|
15134
|
+
} else {
|
|
15135
|
+
for (; ; ) {
|
|
15136
|
+
const left = 2 * at + 1;
|
|
15137
|
+
if (left >= size) break;
|
|
15138
|
+
const right = left + 1;
|
|
15139
|
+
const child = right < size && selection[right] < selection[left] ? right : left;
|
|
15140
|
+
if (selection[child] >= score) break;
|
|
15141
|
+
selection[at] = selection[child];
|
|
15142
|
+
at = child;
|
|
15143
|
+
}
|
|
15144
|
+
}
|
|
15145
|
+
selection[at] = score;
|
|
15146
|
+
}
|
|
15147
|
+
if (wanted === 0) return Number.NEGATIVE_INFINITY;
|
|
15148
|
+
if (size === wanted) return selection[0];
|
|
15149
|
+
return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
|
|
15150
|
+
}
|
|
15151
|
+
function hasScore(buffer, internalId) {
|
|
15152
|
+
return buffer.stamps[internalId] === buffer.generation;
|
|
15153
|
+
}
|
|
15154
|
+
function topKFromBuffer(buffer, k, resolver, components) {
|
|
15155
|
+
const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
|
|
15156
|
+
if (wanted <= 0) return [];
|
|
15157
|
+
const heap = [];
|
|
15158
|
+
const { touched, touchedCount, scores } = buffer;
|
|
15159
|
+
let full = false;
|
|
15160
|
+
let threshold = 0;
|
|
15161
|
+
for (let index = 0; index < touchedCount; index++) {
|
|
15162
|
+
const internalId = touched[index];
|
|
15163
|
+
const score = scores[internalId];
|
|
15164
|
+
if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
|
|
15165
|
+
const externalId = resolver.toExternal(internalId);
|
|
15166
|
+
if (externalId === void 0) continue;
|
|
15167
|
+
const candidate = { internalId, externalId, score };
|
|
15168
|
+
if (!full) {
|
|
15169
|
+
heap.push(candidate);
|
|
15170
|
+
if (heap.length === wanted) {
|
|
15171
|
+
buildMinHeap(heap);
|
|
15172
|
+
full = true;
|
|
15173
|
+
threshold = heap[0].score;
|
|
15174
|
+
}
|
|
15175
|
+
continue;
|
|
15176
|
+
}
|
|
15177
|
+
if (candidateWorse(heap[0], candidate)) {
|
|
15178
|
+
heap[0] = candidate;
|
|
15179
|
+
siftDown(heap, 0);
|
|
15180
|
+
threshold = heap[0].score;
|
|
15181
|
+
}
|
|
15182
|
+
}
|
|
15183
|
+
sortSelection(heap);
|
|
15184
|
+
const result = new Array(heap.length);
|
|
15185
|
+
for (let index = 0; index < heap.length; index++) {
|
|
15186
|
+
const entry = heap[index];
|
|
15187
|
+
const record = components?.get(entry.internalId);
|
|
15188
|
+
result[index] = {
|
|
15189
|
+
docId: entry.externalId,
|
|
15190
|
+
score: entry.score,
|
|
15191
|
+
termFrequencies: record?.termFrequencies ?? EMPTY_COMPONENTS,
|
|
15192
|
+
fieldLengths: record?.fieldLengths ?? EMPTY_COMPONENTS,
|
|
15193
|
+
idf: record?.idf ?? EMPTY_COMPONENTS
|
|
15194
|
+
};
|
|
15195
|
+
}
|
|
15196
|
+
return result;
|
|
15197
|
+
}
|
|
15198
|
+
|
|
15026
15199
|
// src/core/partition/group-scoring.ts
|
|
15027
15200
|
function partialFieldMarks(fieldNames, partialFields) {
|
|
15028
15201
|
const marks = new Uint8Array(fieldNames.length);
|
|
@@ -15076,72 +15249,98 @@ function groupPostingCount(matches) {
|
|
|
15076
15249
|
for (const match of matches) total += match.postingList.length;
|
|
15077
15250
|
return total;
|
|
15078
15251
|
}
|
|
15079
|
-
function
|
|
15080
|
-
const { fields,
|
|
15252
|
+
function scoreMatchPostings(context, match, visit) {
|
|
15253
|
+
const { fields, filterBitset, partialMarks } = context;
|
|
15081
15254
|
const scoresAreZero = context.totalDocs === 0;
|
|
15082
15255
|
const onePair = fields.boundPairs.length === 2;
|
|
15256
|
+
const { docIds, termFrequencies, fieldNameIndices, deletedDocs, hasDeleted, count } = postingColumns(
|
|
15257
|
+
match.postingList
|
|
15258
|
+
);
|
|
15259
|
+
let runStart = 0;
|
|
15260
|
+
let runEnd = 0;
|
|
15261
|
+
for (let at = 0; at < count; at++) {
|
|
15262
|
+
const internalId = docIds[at];
|
|
15263
|
+
if (hasDeleted && deletedDocs.has(internalId)) continue;
|
|
15264
|
+
if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
|
|
15265
|
+
let pi = at;
|
|
15266
|
+
if (at < runEnd) {
|
|
15267
|
+
pi = fieldRun.entries[at - runStart];
|
|
15268
|
+
} else if (at + 2 < count && docIds[at + 2] === internalId) {
|
|
15269
|
+
pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
|
|
15270
|
+
runStart = at;
|
|
15271
|
+
runEnd = at + fieldRun.length;
|
|
15272
|
+
}
|
|
15273
|
+
const fieldIndex = fieldNameIndices[pi];
|
|
15274
|
+
if (fields.searchable[fieldIndex] === 0) continue;
|
|
15275
|
+
const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
|
|
15276
|
+
if (factor === 0) continue;
|
|
15277
|
+
const termFrequency = termFrequencies[pi];
|
|
15278
|
+
const fieldBoost = fields.boosts[fieldIndex];
|
|
15279
|
+
const avgLen = fields.averageLengths[fieldIndex];
|
|
15280
|
+
const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
|
|
15281
|
+
const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
|
|
15282
|
+
termFrequency,
|
|
15283
|
+
match.idf,
|
|
15284
|
+
actualFieldLength,
|
|
15285
|
+
avgLen,
|
|
15286
|
+
onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
|
|
15287
|
+
onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
|
|
15288
|
+
)) * fieldBoost * factor;
|
|
15289
|
+
visit(internalId, fieldIndex, termFrequency, actualFieldLength, termScore);
|
|
15290
|
+
}
|
|
15291
|
+
}
|
|
15292
|
+
var termScores = null;
|
|
15293
|
+
var bestScores = null;
|
|
15294
|
+
function addGroupScores(context, matches, target, only, coverage) {
|
|
15295
|
+
const best = bestGroupScores(context, matches, target.scores.length);
|
|
15296
|
+
for (let index = 0; index < best.touchedCount; index++) {
|
|
15297
|
+
const internalId = best.touched[index];
|
|
15298
|
+
if (only !== null && !bitsetHas(only, internalId)) continue;
|
|
15299
|
+
coverage?.mark(internalId);
|
|
15300
|
+
addScore(target, internalId, best.scores[internalId]);
|
|
15301
|
+
}
|
|
15302
|
+
}
|
|
15303
|
+
function bestGroupScores(context, matches, capacity) {
|
|
15304
|
+
termScores ??= createScoreBuffer(capacity);
|
|
15305
|
+
bestScores ??= createScoreBuffer(capacity);
|
|
15306
|
+
const perTerm = termScores;
|
|
15307
|
+
const best = bestScores;
|
|
15308
|
+
const addTermScore = (internalId, _fieldIndex, _termFrequency, _fieldLength, termScore) => addScore(perTerm, internalId, termScore);
|
|
15309
|
+
beginScoring(best, capacity);
|
|
15310
|
+
for (const match of matches) {
|
|
15311
|
+
beginScoring(perTerm, capacity);
|
|
15312
|
+
scoreMatchPostings(context, match, addTermScore);
|
|
15313
|
+
for (let index = 0; index < perTerm.touchedCount; index++) {
|
|
15314
|
+
const internalId = perTerm.touched[index];
|
|
15315
|
+
const score = perTerm.scores[internalId];
|
|
15316
|
+
if (!hasScore(best, internalId)) addScore(best, internalId, score);
|
|
15317
|
+
else if (compareScores(score, best.scores[internalId]) < 0) best.scores[internalId] = score;
|
|
15318
|
+
}
|
|
15319
|
+
}
|
|
15320
|
+
return best;
|
|
15321
|
+
}
|
|
15322
|
+
function computeGroupContributions(context, matches) {
|
|
15323
|
+
const { fieldNames } = context;
|
|
15083
15324
|
const best = /* @__PURE__ */ new Map();
|
|
15084
15325
|
for (const match of matches) {
|
|
15085
15326
|
const perTerm = /* @__PURE__ */ new Map();
|
|
15086
|
-
|
|
15087
|
-
match.postingList
|
|
15088
|
-
);
|
|
15089
|
-
let runStart = 0;
|
|
15090
|
-
let runEnd = 0;
|
|
15091
|
-
for (let at = 0; at < count; at++) {
|
|
15092
|
-
const internalId = docIds[at];
|
|
15093
|
-
if (hasDeleted && deletedDocs.has(internalId)) continue;
|
|
15094
|
-
if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
|
|
15095
|
-
let pi = at;
|
|
15096
|
-
if (at < runEnd) {
|
|
15097
|
-
pi = fieldRun.entries[at - runStart];
|
|
15098
|
-
} else if (at + 2 < count && docIds[at + 2] === internalId) {
|
|
15099
|
-
pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
|
|
15100
|
-
runStart = at;
|
|
15101
|
-
runEnd = at + fieldRun.length;
|
|
15102
|
-
}
|
|
15103
|
-
const fieldIndex = fieldNameIndices[pi];
|
|
15104
|
-
if (fields.searchable[fieldIndex] === 0) continue;
|
|
15105
|
-
const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
|
|
15106
|
-
if (factor === 0) continue;
|
|
15327
|
+
scoreMatchPostings(context, match, (internalId, fieldIndex, termFrequency, actualFieldLength, termScore) => {
|
|
15107
15328
|
const fieldName = fieldNames[fieldIndex];
|
|
15108
|
-
const termFrequency = termFrequencies[pi];
|
|
15109
|
-
const fieldBoost = fields.boosts[fieldIndex];
|
|
15110
|
-
const avgLen = fields.averageLengths[fieldIndex];
|
|
15111
|
-
const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
|
|
15112
|
-
const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
|
|
15113
|
-
termFrequency,
|
|
15114
|
-
match.idf,
|
|
15115
|
-
actualFieldLength,
|
|
15116
|
-
avgLen,
|
|
15117
|
-
onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
|
|
15118
|
-
onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
|
|
15119
|
-
)) * fieldBoost * factor;
|
|
15120
15329
|
const existing = perTerm.get(internalId);
|
|
15121
15330
|
if (existing) {
|
|
15122
15331
|
existing.score += termScore;
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
}
|
|
15127
|
-
} else if (collect) {
|
|
15128
|
-
perTerm.set(internalId, {
|
|
15129
|
-
score: termScore,
|
|
15130
|
-
token: match.token,
|
|
15131
|
-
idf: match.idf,
|
|
15132
|
-
termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
|
|
15133
|
-
fieldLengths: { [fieldName]: actualFieldLength }
|
|
15134
|
-
});
|
|
15135
|
-
} else {
|
|
15136
|
-
perTerm.set(internalId, {
|
|
15137
|
-
score: termScore,
|
|
15138
|
-
token: match.token,
|
|
15139
|
-
idf: match.idf,
|
|
15140
|
-
termFrequencies: EMPTY_COMPONENTS,
|
|
15141
|
-
fieldLengths: EMPTY_COMPONENTS
|
|
15142
|
-
});
|
|
15332
|
+
existing.termFrequencies[`${fieldName}:${match.token}`] = termFrequency;
|
|
15333
|
+
existing.fieldLengths[fieldName] = actualFieldLength;
|
|
15334
|
+
return;
|
|
15143
15335
|
}
|
|
15144
|
-
|
|
15336
|
+
perTerm.set(internalId, {
|
|
15337
|
+
score: termScore,
|
|
15338
|
+
token: match.token,
|
|
15339
|
+
idf: match.idf,
|
|
15340
|
+
termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
|
|
15341
|
+
fieldLengths: { [fieldName]: actualFieldLength }
|
|
15342
|
+
});
|
|
15343
|
+
});
|
|
15145
15344
|
for (const [internalId, contribution] of perTerm) {
|
|
15146
15345
|
const current = best.get(internalId);
|
|
15147
15346
|
if (!current || compareScores(contribution.score, current.score) < 0) {
|
|
@@ -15668,177 +15867,6 @@ function blockBoundsFor(list, columns) {
|
|
|
15668
15867
|
return built2;
|
|
15669
15868
|
}
|
|
15670
15869
|
|
|
15671
|
-
// src/core/partition/top-k-heap.ts
|
|
15672
|
-
function candidateWorse(a, b) {
|
|
15673
|
-
if (a.score < b.score) return true;
|
|
15674
|
-
if (a.score > b.score) return false;
|
|
15675
|
-
return unorderedCandidateWorse(a, b);
|
|
15676
|
-
}
|
|
15677
|
-
function unorderedCandidateWorse(a, b) {
|
|
15678
|
-
return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
|
|
15679
|
-
}
|
|
15680
|
-
function buildMinHeap(heap) {
|
|
15681
|
-
for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
|
|
15682
|
-
siftDown(heap, index);
|
|
15683
|
-
}
|
|
15684
|
-
}
|
|
15685
|
-
function siftDown(heap, start) {
|
|
15686
|
-
const len = heap.length;
|
|
15687
|
-
let current = start;
|
|
15688
|
-
for (; ; ) {
|
|
15689
|
-
let worst = current;
|
|
15690
|
-
const left = 2 * current + 1;
|
|
15691
|
-
const right = 2 * current + 2;
|
|
15692
|
-
if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
|
|
15693
|
-
if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
|
|
15694
|
-
if (worst === current) break;
|
|
15695
|
-
const held = heap[current];
|
|
15696
|
-
heap[current] = heap[worst];
|
|
15697
|
-
heap[worst] = held;
|
|
15698
|
-
current = worst;
|
|
15699
|
-
}
|
|
15700
|
-
}
|
|
15701
|
-
function sortSelection(heap) {
|
|
15702
|
-
heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
|
|
15703
|
-
}
|
|
15704
|
-
|
|
15705
|
-
// src/core/partition/score-buffer.ts
|
|
15706
|
-
var MAX_GENERATION = 2147483647;
|
|
15707
|
-
function createScoreBuffer(capacity) {
|
|
15708
|
-
return {
|
|
15709
|
-
scores: new Float64Array(capacity),
|
|
15710
|
-
stamps: new Int32Array(capacity),
|
|
15711
|
-
touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
|
|
15712
|
-
touchedCount: 0,
|
|
15713
|
-
generation: 0
|
|
15714
|
-
};
|
|
15715
|
-
}
|
|
15716
|
-
function beginScoring(buffer, capacity) {
|
|
15717
|
-
if (buffer.scores.length < capacity) {
|
|
15718
|
-
buffer.scores = new Float64Array(capacity);
|
|
15719
|
-
buffer.stamps = new Int32Array(capacity);
|
|
15720
|
-
buffer.generation = 0;
|
|
15721
|
-
}
|
|
15722
|
-
if (buffer.generation >= MAX_GENERATION) {
|
|
15723
|
-
buffer.stamps.fill(0);
|
|
15724
|
-
buffer.generation = 0;
|
|
15725
|
-
}
|
|
15726
|
-
buffer.generation++;
|
|
15727
|
-
buffer.touchedCount = 0;
|
|
15728
|
-
}
|
|
15729
|
-
function appendTouched(buffer, internalId) {
|
|
15730
|
-
if (buffer.touchedCount === buffer.touched.length) {
|
|
15731
|
-
const grown2 = new Int32Array(buffer.touched.length * 2);
|
|
15732
|
-
grown2.set(buffer.touched);
|
|
15733
|
-
buffer.touched = grown2;
|
|
15734
|
-
}
|
|
15735
|
-
buffer.touched[buffer.touchedCount] = internalId;
|
|
15736
|
-
buffer.touchedCount++;
|
|
15737
|
-
}
|
|
15738
|
-
function addScore(buffer, internalId, termScore) {
|
|
15739
|
-
if (buffer.stamps[internalId] === buffer.generation) {
|
|
15740
|
-
buffer.scores[internalId] += termScore;
|
|
15741
|
-
return;
|
|
15742
|
-
}
|
|
15743
|
-
buffer.stamps[internalId] = buffer.generation;
|
|
15744
|
-
buffer.scores[internalId] = termScore;
|
|
15745
|
-
appendTouched(buffer, internalId);
|
|
15746
|
-
}
|
|
15747
|
-
function markCounted(buffer, internalId) {
|
|
15748
|
-
const countedStamp = -buffer.generation;
|
|
15749
|
-
const stamp = buffer.stamps[internalId];
|
|
15750
|
-
if (stamp === buffer.generation || stamp === countedStamp) return false;
|
|
15751
|
-
buffer.stamps[internalId] = countedStamp;
|
|
15752
|
-
return true;
|
|
15753
|
-
}
|
|
15754
|
-
function kthBestScore(buffer, selection, resolver) {
|
|
15755
|
-
const wanted = selection.length;
|
|
15756
|
-
const { touched, touchedCount, scores } = buffer;
|
|
15757
|
-
let size = 0;
|
|
15758
|
-
let unordered = 0;
|
|
15759
|
-
for (let index = 0; index < touchedCount; index++) {
|
|
15760
|
-
const internalId = touched[index];
|
|
15761
|
-
const score = scores[internalId];
|
|
15762
|
-
if (size === wanted && !(score > selection[0])) continue;
|
|
15763
|
-
if (!resolver.isLive(internalId)) continue;
|
|
15764
|
-
let at = 0;
|
|
15765
|
-
if (size < wanted) {
|
|
15766
|
-
if (Number.isNaN(score)) {
|
|
15767
|
-
unordered++;
|
|
15768
|
-
continue;
|
|
15769
|
-
}
|
|
15770
|
-
at = size++;
|
|
15771
|
-
while (at > 0) {
|
|
15772
|
-
const parent = at - 1 >> 1;
|
|
15773
|
-
if (selection[parent] <= score) break;
|
|
15774
|
-
selection[at] = selection[parent];
|
|
15775
|
-
at = parent;
|
|
15776
|
-
}
|
|
15777
|
-
} else {
|
|
15778
|
-
for (; ; ) {
|
|
15779
|
-
const left = 2 * at + 1;
|
|
15780
|
-
if (left >= size) break;
|
|
15781
|
-
const right = left + 1;
|
|
15782
|
-
const child = right < size && selection[right] < selection[left] ? right : left;
|
|
15783
|
-
if (selection[child] >= score) break;
|
|
15784
|
-
selection[at] = selection[child];
|
|
15785
|
-
at = child;
|
|
15786
|
-
}
|
|
15787
|
-
}
|
|
15788
|
-
selection[at] = score;
|
|
15789
|
-
}
|
|
15790
|
-
if (wanted === 0) return Number.NEGATIVE_INFINITY;
|
|
15791
|
-
if (size === wanted) return selection[0];
|
|
15792
|
-
return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
|
|
15793
|
-
}
|
|
15794
|
-
function hasScore(buffer, internalId) {
|
|
15795
|
-
return buffer.stamps[internalId] === buffer.generation;
|
|
15796
|
-
}
|
|
15797
|
-
function topKFromBuffer(buffer, k, resolver, components) {
|
|
15798
|
-
const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
|
|
15799
|
-
if (wanted <= 0) return [];
|
|
15800
|
-
const heap = [];
|
|
15801
|
-
const { touched, touchedCount, scores } = buffer;
|
|
15802
|
-
let full = false;
|
|
15803
|
-
let threshold = 0;
|
|
15804
|
-
for (let index = 0; index < touchedCount; index++) {
|
|
15805
|
-
const internalId = touched[index];
|
|
15806
|
-
const score = scores[internalId];
|
|
15807
|
-
if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
|
|
15808
|
-
const externalId = resolver.toExternal(internalId);
|
|
15809
|
-
if (externalId === void 0) continue;
|
|
15810
|
-
const candidate = { internalId, externalId, score };
|
|
15811
|
-
if (!full) {
|
|
15812
|
-
heap.push(candidate);
|
|
15813
|
-
if (heap.length === wanted) {
|
|
15814
|
-
buildMinHeap(heap);
|
|
15815
|
-
full = true;
|
|
15816
|
-
threshold = heap[0].score;
|
|
15817
|
-
}
|
|
15818
|
-
continue;
|
|
15819
|
-
}
|
|
15820
|
-
if (candidateWorse(heap[0], candidate)) {
|
|
15821
|
-
heap[0] = candidate;
|
|
15822
|
-
siftDown(heap, 0);
|
|
15823
|
-
threshold = heap[0].score;
|
|
15824
|
-
}
|
|
15825
|
-
}
|
|
15826
|
-
sortSelection(heap);
|
|
15827
|
-
const result = new Array(heap.length);
|
|
15828
|
-
for (let index = 0; index < heap.length; index++) {
|
|
15829
|
-
const entry = heap[index];
|
|
15830
|
-
const record = components?.get(entry.internalId);
|
|
15831
|
-
result[index] = {
|
|
15832
|
-
docId: entry.externalId,
|
|
15833
|
-
score: entry.score,
|
|
15834
|
-
termFrequencies: record?.termFrequencies ?? EMPTY_COMPONENTS,
|
|
15835
|
-
fieldLengths: record?.fieldLengths ?? EMPTY_COMPONENTS,
|
|
15836
|
-
idf: record?.idf ?? EMPTY_COMPONENTS
|
|
15837
|
-
};
|
|
15838
|
-
}
|
|
15839
|
-
return result;
|
|
15840
|
-
}
|
|
15841
|
-
|
|
15842
15870
|
// src/core/partition/multi-term-topk.ts
|
|
15843
15871
|
function prunableMultiTermLists(params, index) {
|
|
15844
15872
|
if (params.queryTokens.length < 2) return null;
|
|
@@ -16473,10 +16501,14 @@ function searchFulltext(state, params) {
|
|
|
16473
16501
|
}
|
|
16474
16502
|
function scoreGroup(group, only) {
|
|
16475
16503
|
if (group === null) return;
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16504
|
+
if (components !== null) {
|
|
16505
|
+
for (const [internalId, contribution] of computeGroupContributions(groupContext, group)) {
|
|
16506
|
+
if (only !== null && !bitsetHas(only, internalId)) continue;
|
|
16507
|
+
mergeGroupContribution(internalId, contribution);
|
|
16508
|
+
}
|
|
16509
|
+
return;
|
|
16479
16510
|
}
|
|
16511
|
+
addGroupScores(groupContext, group, scoreBuffer, only, coverage);
|
|
16480
16512
|
}
|
|
16481
16513
|
const prunableList = phrases === void 0 ? prunableSingleTermList(params, state.invertedIdx, fieldNames) : null;
|
|
16482
16514
|
if (prunableList !== null && maxResults !== void 0) {
|
|
@@ -19206,7 +19238,7 @@ var storageCode = codeLoader(async () => {
|
|
|
19206
19238
|
loadSegmentMerge(),
|
|
19207
19239
|
loadSuggestionStore(),
|
|
19208
19240
|
loadVectorCore(),
|
|
19209
|
-
import('./storage-leaf-
|
|
19241
|
+
import('./storage-leaf-42IZEOJJ.mjs')
|
|
19210
19242
|
]);
|
|
19211
19243
|
code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
|
|
19212
19244
|
return code7;
|
|
@@ -19905,6 +19937,7 @@ function writesHostPart() {
|
|
|
19905
19937
|
requireDocumentWithinSizeLimit,
|
|
19906
19938
|
requireMatchingDocId,
|
|
19907
19939
|
requireSurfaceFormsForPartialFields,
|
|
19940
|
+
setNestedValue,
|
|
19908
19941
|
storedBM25Params,
|
|
19909
19942
|
turnsAreBudgeted,
|
|
19910
19943
|
updateDocumentVectors,
|
|
@@ -19955,7 +19988,7 @@ var loaded2 = null;
|
|
|
19955
19988
|
var loading3 = null;
|
|
19956
19989
|
function importOptionalReads() {
|
|
19957
19990
|
if (loaded2 !== null) return Promise.resolve(loaded2);
|
|
19958
|
-
loading3 ??= import('./optional-reads-
|
|
19991
|
+
loading3 ??= import('./optional-reads-NQO5DKM4.mjs').then(
|
|
19959
19992
|
(code7) => {
|
|
19960
19993
|
code7.bindOptionalReadsHost(optionalCodeHost());
|
|
19961
19994
|
loaded2 = code7;
|
|
@@ -21022,7 +21055,7 @@ function createAnalysisRebuildCoordinator(config, deps) {
|
|
|
21022
21055
|
|
|
21023
21056
|
// src/engine/durability-config-code.ts
|
|
21024
21057
|
var durabilityConfig = codeLoader(
|
|
21025
|
-
() => import('./durability-config-
|
|
21058
|
+
() => import('./durability-config-UP3OTUMB.mjs').then((code7) => {
|
|
21026
21059
|
code7.bindDurabilityConfigHost(optionalCodeHost());
|
|
21027
21060
|
return code7;
|
|
21028
21061
|
}),
|
|
@@ -21620,7 +21653,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
|
21620
21653
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
|
|
21621
21654
|
}
|
|
21622
21655
|
const durabilityWiring = durabilityTier === null ? null : (await Promise.all([loadStorageCode(), loadOptionalWrites()]))[0];
|
|
21623
|
-
const filesystemDurability = durabilityTier?.kind === "wal";
|
|
21656
|
+
const filesystemDurability = durabilityTier?.kind === "wal" && durabilityTier.indexedDB === void 0;
|
|
21624
21657
|
const executor = createDirectExecutor({
|
|
21625
21658
|
vectorWorkerCopies: vectorCopyPolicy,
|
|
21626
21659
|
vectorStorage: filesystemDurability ? "disk" : "memory",
|
|
@@ -21895,8 +21928,13 @@ async function shutdownEngine(core2) {
|
|
|
21895
21928
|
await core2.analysisRebuild.shutdown();
|
|
21896
21929
|
await core2.querySuggestionHooks?.shutdown();
|
|
21897
21930
|
core2.indexState.dispose();
|
|
21931
|
+
let durabilityFailure = null;
|
|
21898
21932
|
if (durability) {
|
|
21899
|
-
|
|
21933
|
+
try {
|
|
21934
|
+
await durability.manager.shutdown();
|
|
21935
|
+
} catch (error) {
|
|
21936
|
+
durabilityFailure = { error };
|
|
21937
|
+
}
|
|
21900
21938
|
}
|
|
21901
21939
|
const vectorDisposals = [];
|
|
21902
21940
|
for (const [name] of indexRegistry) {
|
|
@@ -21930,6 +21968,7 @@ async function shutdownEngine(core2) {
|
|
|
21930
21968
|
await Promise.all(vectorDisposals);
|
|
21931
21969
|
eventHandlers.clear();
|
|
21932
21970
|
indexRegistry.clear();
|
|
21971
|
+
if (durabilityFailure !== null) throw durabilityFailure.error;
|
|
21933
21972
|
}
|
|
21934
21973
|
|
|
21935
21974
|
// src/engine/startup-checks.ts
|
|
@@ -1203,7 +1203,7 @@ var loaded = null;
|
|
|
1203
1203
|
var loading = null;
|
|
1204
1204
|
function loadMessagePack() {
|
|
1205
1205
|
if (loaded !== null) return Promise.resolve(loaded);
|
|
1206
|
-
loading ??= import('./msgpack-leaf-
|
|
1206
|
+
loading ??= import('./msgpack-leaf-76Q5SZ5S.mjs').then(
|
|
1207
1207
|
(code) => {
|
|
1208
1208
|
code.bindMsgpackHost({
|
|
1209
1209
|
BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes, loadMessagePack, ClientErrorCodes, ServerErrorCodes, describeError } from './chunk-
|
|
1
|
+
import { NarsilError, ErrorCodes, loadMessagePack, ClientErrorCodes, ServerErrorCodes, describeError } from './chunk-VAPCFSMX.mjs';
|
|
2
2
|
|
|
3
3
|
// src/json-encoding.ts
|
|
4
4
|
function toPlainNumbers(key, value) {
|