@delali/narsil 0.4.2-next.271 → 0.4.2

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.
Files changed (103) hide show
  1. package/dist/browser/{chunk-XBWABEL3.mjs → chunk-56UNHLAF.mjs} +1 -1
  2. package/dist/browser/{chunk-DPRCAVC2.mjs → chunk-EKISQBV2.mjs} +272 -239
  3. package/dist/browser/{chunk-WRRXR57N.mjs → chunk-VAPCFSMX.mjs} +1 -1
  4. package/dist/browser/{chunk-Y5CSZDOH.mjs → chunk-VIVG3OXM.mjs} +1 -1
  5. package/dist/browser/{msgpack-leaf-FEPCLXXY.mjs → msgpack-leaf-76Q5SZ5S.mjs} +16 -9
  6. package/dist/browser/{optional-writes-HVPPDHSY.mjs → optional-writes-3HKIVZFU.mjs} +36 -2
  7. package/dist/browser/{segment-codec-leaf-A427QJUX.mjs → segment-codec-leaf-GXSRX5VT.mjs} +47 -30
  8. package/dist/{chunk-TI4G3SIG.mjs → chunk-35RWLUVY.mjs} +3 -3
  9. package/dist/{chunk-GTBJSNN2.mjs → chunk-43T3P3BE.mjs} +1 -1
  10. package/dist/{chunk-KQWTS7AM.mjs → chunk-4JLHHEBN.mjs} +1 -1
  11. package/dist/{chunk-KX3OP6VP.mjs → chunk-4YIVY3PB.mjs} +2 -2
  12. package/dist/{react-native/chunks/chunk-XGS2UYVI.mjs → chunk-5SHWA6PE.mjs} +1 -1
  13. package/dist/{chunk-BBIAUHAB.mjs → chunk-6LVQ3GLT.mjs} +3 -3
  14. package/dist/{chunk-H6LWGMPQ.mjs → chunk-6SIEVWMG.mjs} +7 -7
  15. package/dist/{chunk-NFA3WHJU.mjs → chunk-ACNHJOGC.mjs} +1 -1
  16. package/dist/{chunk-FOGTBAYN.mjs → chunk-BWPVDIRN.mjs} +12 -12
  17. package/dist/{chunk-ATQ6JR3I.mjs → chunk-C57GWAXN.mjs} +1 -1
  18. package/dist/{chunk-5E3TJ4P3.mjs → chunk-DRZP5MSG.mjs} +5 -5
  19. package/dist/{chunk-OLXFIUIZ.mjs → chunk-DZMD4OMD.mjs} +1 -1
  20. package/dist/{chunk-4WQNWAQE.mjs → chunk-EY5U4P5V.mjs} +1 -1
  21. package/dist/{chunk-Q4NLL66U.mjs → chunk-EZJ6HBG7.mjs} +2 -2
  22. package/dist/{chunk-QJFKL4NK.mjs → chunk-FE2XILWN.mjs} +4 -4
  23. package/dist/{chunk-WIT6B5OB.mjs → chunk-G3KVEHIW.mjs} +2 -2
  24. package/dist/{chunk-TANKI7TG.mjs → chunk-GTGQLCEI.mjs} +1 -1
  25. package/dist/{chunk-EALKCTWH.mjs → chunk-H23FB267.mjs} +3 -3
  26. package/dist/{chunk-YHZSSPG3.mjs → chunk-KXA77DPZ.mjs} +2 -2
  27. package/dist/{chunk-XWPNRHTG.mjs → chunk-LRIJ7U3T.mjs} +4 -4
  28. package/dist/{chunk-SSITKQU6.mjs → chunk-PNFP5THV.mjs} +3 -3
  29. package/dist/{chunk-VHIOGDVD.mjs → chunk-PQWK7KXS.mjs} +1 -1
  30. package/dist/{chunk-TT3UDDL3.mjs → chunk-QNZJYMCF.mjs} +6 -6
  31. package/dist/{chunk-33ZMFOAR.mjs → chunk-R3PFPFME.mjs} +1 -1
  32. package/dist/{chunk-XGVSG6ZU.mjs → chunk-SPA7GXST.mjs} +3 -3
  33. package/dist/{chunk-MS746XNY.mjs → chunk-WYH3QHBK.mjs} +384 -304
  34. package/dist/{chunk-MIIJ5O3O.mjs → chunk-X5V25BPN.mjs} +1 -1
  35. package/dist/{chunk-5GYGHPCH.mjs → chunk-Y7GXGJFZ.mjs} +16 -9
  36. package/dist/{chunk-4GCHJ3XD.mjs → chunk-YGRJLI2Z.mjs} +4 -4
  37. package/dist/{react-native/chunks/chunk-LE4DTMDL.mjs → chunk-ZO7VLAIT.mjs} +2 -2
  38. package/dist/{chunk-W3JH2IK6.mjs → chunk-ZTB7AWTW.mjs} +1 -1
  39. package/dist/client.mjs +2 -2
  40. package/dist/{direct-executor-PCBB6FCO.mjs → direct-executor-7G57AYXH.mjs} +4 -4
  41. package/dist/distribution/coordinator/etcd.mjs +2 -2
  42. package/dist/distribution/transport/grpc.mjs +3 -3
  43. package/dist/distribution/transport/tcp.mjs +3 -3
  44. package/dist/distribution.mjs +29 -29
  45. package/dist/index.browser.mjs +3 -3
  46. package/dist/index.mjs +4 -4
  47. package/dist/index.react-native.mjs +4 -4
  48. package/dist/{long-query-thread-4ALYIIC4.mjs → long-query-thread-KPN7NSOC.mjs} +14 -14
  49. package/dist/{msgpack-leaf-6ZBZWFRD.mjs → msgpack-leaf-LIT7TKZW.mjs} +3 -3
  50. package/dist/{optional-writes-2OK4TOLY.mjs → optional-writes-CSULLISE.mjs} +6 -6
  51. package/dist/{paged-partition-archive-Y5OAKNRB.mjs → paged-partition-archive-BKQADXOT.mjs} +13 -13
  52. package/dist/partial-words.browser.mjs +3 -3
  53. package/dist/partial-words.mjs +4 -4
  54. package/dist/pattern.browser.mjs +2 -2
  55. package/dist/pattern.mjs +2 -2
  56. package/dist/persistence/durability/checkpoint-worker.mjs +11 -11
  57. package/dist/{query-actions-UQVQZFIJ.mjs → query-actions-HTSJKZRU.mjs} +4 -4
  58. package/dist/query-suggestions/merge-worker.mjs +7 -7
  59. package/dist/query-suggestions.browser.mjs +3 -3
  60. package/dist/query-suggestions.mjs +5 -5
  61. package/dist/react-native/chunks/{chunk-AVCMTWET.mjs → chunk-AOLLV37A.mjs} +1 -1
  62. package/dist/react-native/chunks/{chunk-VRI5XH2M.mjs → chunk-DN4FT62B.mjs} +16 -9
  63. package/dist/react-native/chunks/{chunk-VIO5IPF7.mjs → chunk-EF4Y5C3Y.mjs} +2 -2
  64. package/dist/react-native/chunks/{chunk-GS6LGXY3.mjs → chunk-ESVBC3AT.mjs} +1 -1
  65. package/dist/react-native/chunks/{chunk-4OOUY2K7.mjs → chunk-H6LK5WCF.mjs} +1 -1
  66. package/dist/react-native/chunks/{chunk-5MYHYBET.mjs → chunk-JEYZQA4Z.mjs} +384 -304
  67. package/dist/react-native/chunks/{chunk-XW6GZQWP.mjs → chunk-KJQ3BUVM.mjs} +4 -4
  68. package/dist/{chunk-DA32WXBT.mjs → react-native/chunks/chunk-QYVRD6C5.mjs} +2 -2
  69. package/dist/react-native/chunks/{chunk-Z44S6WW5.mjs → chunk-X3VY2YT4.mjs} +2 -2
  70. package/dist/{chunk-OETLM4EH.mjs → react-native/chunks/chunk-ZF3VSGEI.mjs} +1 -1
  71. package/dist/react-native/chunks/{msgpack-leaf-4MIGXWZT.mjs → msgpack-leaf-FOUPTT7J.mjs} +3 -3
  72. package/dist/react-native/chunks/{optional-writes-LZDHB7FX.mjs → optional-writes-MGFFGKYQ.mjs} +5 -5
  73. package/dist/react-native/chunks/{restore-queue-J7SB263E.mjs → restore-queue-MVJTP3E4.mjs} +7 -7
  74. package/dist/react-native/chunks/{segment-codec-leaf-PEKX7TBL.mjs → segment-codec-leaf-PSWHL55A.mjs} +5 -5
  75. package/dist/react-native/chunks/{segment-merge-leaf-I2EC7H6R.mjs → segment-merge-leaf-WOJWSDLW.mjs} +6 -6
  76. package/dist/react-native/chunks/{storage-leaf-RQXM7HBO.mjs → storage-leaf-ZUN6Y44X.mjs} +9 -9
  77. package/dist/react-native/chunks/{store-leaf-EZGCLSLM.mjs → store-leaf-K5XG46FV.mjs} +6 -6
  78. package/dist/react-native/chunks/{suggestions-leaf-JNGH2JYC.mjs → suggestions-leaf-KDPM3P27.mjs} +6 -6
  79. package/dist/react-native/chunks/{worker-copies-2OWLLBCV.mjs → worker-copies-FVFMBBH6.mjs} +5 -5
  80. package/dist/react-native/partial-words.mjs +4 -4
  81. package/dist/react-native/pattern.mjs +2 -2
  82. package/dist/react-native/query-suggestions.mjs +4 -4
  83. package/dist/react-native/sync.mjs +4 -4
  84. package/dist/react-native/synonyms.mjs +4 -4
  85. package/dist/{rerank-TQ4SU76L.mjs → rerank-3QEJNMFH.mjs} +4 -4
  86. package/dist/{restore-queue-W7U2X6V3.mjs → restore-queue-Q76Q4S35.mjs} +7 -7
  87. package/dist/{segment-codec-leaf-WGP4FBXF.mjs → segment-codec-leaf-BSDDR7DQ.mjs} +5 -5
  88. package/dist/{segment-merge-leaf-FYWJQSPL.mjs → segment-merge-leaf-6TT66HC5.mjs} +5 -5
  89. package/dist/server.mjs +20 -20
  90. package/dist/{storage-leaf-GRG44RQA.mjs → storage-leaf-R5JQ2X2M.mjs} +22 -22
  91. package/dist/{store-leaf-YDJVH73G.mjs → store-leaf-NCGETZYY.mjs} +6 -6
  92. package/dist/{suggestions-leaf-5UFJV7SC.mjs → suggestions-leaf-TX3GTD6S.mjs} +8 -8
  93. package/dist/sync/filesystem.mjs +9 -9
  94. package/dist/sync/indexeddb.browser.mjs +1 -1
  95. package/dist/sync/indexeddb.mjs +2 -2
  96. package/dist/sync.browser.mjs +4 -4
  97. package/dist/sync.mjs +4 -4
  98. package/dist/synonyms.browser.mjs +3 -3
  99. package/dist/synonyms.mjs +4 -4
  100. package/dist/{thread-6YLVL2NC.mjs → thread-VLVPAUWC.mjs} +13 -13
  101. package/dist/{worker-copies-IP4L7KEW.mjs → worker-copies-NZSBQZKG.mjs} +7 -7
  102. package/dist/workers/entry.mjs +10 -10
  103. package/package.json +7 -5
@@ -1,11 +1,11 @@
1
1
  import { reservedHeapBytes, reserveHeapBytes, collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal, admittedHeapBytes } from './chunk-HQEVQEDJ.mjs';
2
2
  import { fnv1aUtf16, changeIndexOutsideExternalWaits, turnsAreBudgeted, turnIsSpent, yieldTurn, createDocIdMap, detectRuntime, fnv1a, indexChangeOutsideExternalWaits, stopOfSignal, splitWorkerBudget, resolveWorkerCount, sharedStopOfSignal, requireSearchActive, yieldBackgroundTurn, backgroundTurnIsSpent, FNV_OFFSET_BASIS, DEFAULT_REQUEST_TIMEOUT_MS, countWrite, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, answerFromOneState, signalOfSearch, requirePinnedState, fnv1aContinue, fnv1aContinueTaggedNumbers, FNV_PRIME, collectAndReturnPages, shardEntryRangeOf, threadSlotOfWorker, resolveRequestThreadCount, SHUTDOWN_TIMEOUT_MS, DEFAULT_BACKPRESSURE_LIMIT, threadSlotGone, spawnNodeWorker, resolveWorkerEntry, noteThreadSlotLive, noteThreadSlotGone, bindSearchSignal, adoptSharedTurns, WORKER_YOUNG_GENERATION_MB, WASM_PAGE_BYTES, VECTOR_STORE_INITIAL_CAPACITY, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_INSERT_TIMEOUT_MS, VECTOR_BLOCK_MAX_BYTES, VECTOR_BLOCK_INITIAL_SLOTS, UNPLACED_FLAG_CHUNK_ORDINALS, NATIVE_THREAD_SEARCH_SLOTS, NATIVE_THREAD_SCAN_CHUNK_ORDINALS, NATIVE_ATTACH_RETRY_MS, MAX_WASM_PAGES, MAX_VECTOR_ORDINALS, MAX_RENUMBERED_SEARCH_ATTEMPTS, MAX_DOC_ID_TABLE_BYTES, LOCK_WAIT_SLICE_MS, LOCK_SPIN_ITERATIONS, GRAPH_LOCK_WAIT_SLICE_MS, GRAPH_LOCK_WAIT_DEADLINE_MS, GRAPH_BUILD_DISPATCH_CHUNK, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, DISK_STORAGE_BLOCK_BYTES, waitOutsideCountedWrite, nodeThreadId } from './chunk-AKRYHAVG.mjs';
3
3
  import { MIN_DOCUMENTS_FOR_SEGMENTS, MAX_PARTITIONS, MAX_INDEX_CONFIGURATION_BYTES, BATCH_CHUNK_SIZE, BM25_DISPLAYED_NAME_LENGTH, MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, MAX_DOC_ID_LENGTH, MAX_CALLS_ACROSS_INDEX_CHANGES, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, MAX_SWEEP_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, MIN_SWEEP_INTERVAL_MS, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, DEFAULT_FUZZY_PREFIX_LENGTH, DEFAULT_LIMIT, DEFAULT_OFFSET, RESULT_WINDOW, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, DEFAULT_PAGE_SIZE, CURSOR_BINDING_BUFFER_BYTES, PREFIX_MAX_EXPANSIONS, HEAP_PRESSURE_REARM_FRACTION, MAX_TOLERANCE, MAX_PREFIX_LENGTH, MIN_RANK_CONSTANT, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, FUSION_TIE_INSERTION_LIMIT, DEFAULT_RANK_CONSTANT, DEFAULT_LINEAR_ALPHA, STATISTICS_BROADCAST_INTERVAL_MS, MAX_IMPORT_REFUSALS_REPORTED, MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, FOREIGN_STATS_TTL_MS, EXPORT_CHUNK_BYTES, DEFAULT_MAX_PARTITIONS, ANALYSIS_HOLD_APPLY_INTERVAL_MS, ANALYSIS_CHANGE_MEMBERS, MIN_HYBRID_DEPTH, MAX_SUGGEST_SCATTER_LIMIT, MAX_SUGGEST_LIMIT, MAX_QUERY_PHRASES, MAX_PHRASE_WORDS, MAX_HYBRID_DEPTH, HYBRID_RESCORE_WINDOW, DEFAULT_SUGGEST_LIMIT, DEFAULT_MAX_PER_GROUP } from './chunk-LX62Y4B5.mjs';
4
- import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, DEFAULT_PATTERN_WORK_CAP, bitsetHas, bitsetClear, storedText, cachedStoredFields, storedValuesOf, bitsetSet, discardStoredValues, createBitSet, installStoredFields, storedValueBytes, bitsetIsEmpty, prepareStoredValues, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, fuzzyPrefixOf, boundedLevenshtein, checkedSize, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, buildStoredValues, FILTER_OPERAND_COPY_DEPTH, fuzzyTermMatches, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES, bitsetIterator, GrowableUint32, bitsetFromSet } from './chunk-GS6LGXY3.mjs';
4
+ import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, DEFAULT_PATTERN_WORK_CAP, bitsetHas, bitsetClear, storedText, cachedStoredFields, storedValuesOf, bitsetSet, discardStoredValues, createBitSet, installStoredFields, storedValueBytes, bitsetIsEmpty, prepareStoredValues, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, fuzzyPrefixOf, boundedLevenshtein, checkedSize, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, buildStoredValues, FILTER_OPERAND_COPY_DEPTH, fuzzyTermMatches, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES, bitsetIterator, GrowableUint32, bitsetFromSet } from './chunk-ESVBC3AT.mjs';
5
5
  import { nativeSearchCoreIsEnabled, loadNativeCore, noteFallback, NATIVE_NEEDS_ROOM, NATIVE_OK } from './chunk-UYKIV2KT.mjs';
6
6
  import { reactNativeHost } from './chunk-CW2ZFXSE.mjs';
7
- import { headerAt, MAP_TAGS, decode, encodeDocument, Decoder } from './chunk-VRI5XH2M.mjs';
8
- import { parsedTypeOf, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, schemaFieldsOf, getNestedValue, tokenizeOptions, flattenSchema, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, vectorDimensionOf, isSingleStringFieldType, messagePackUpperBoundBytes, extractVectorFieldsFromSchema, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, loadMessagePack, validateRequiredFields, requireDocumentWithinSizeLimit, raiseEarlierReleaseGraphSetting, PROTOTYPE_POLLUTION_KEYS, isPlainObject, isWordIndexedFieldType, loadedMessagePack, validateDocument, validateDocumentStrict, textFieldsChanged, MAX_NESTING_DEPTH, getFlatSchema, getOrCreateFieldNameIndex, isWordIndexedBase, isStringValuedBase, requireValidFieldTypes, parseVectorDimension, isStorageMode, isQuantizationMode, MAX_DOCUMENT_NESTING_DEPTH, 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 } from './chunk-AVCMTWET.mjs';
7
+ import { headerAt, MAP_TAGS, decode, encodeDocument, Decoder } from './chunk-DN4FT62B.mjs';
8
+ import { parsedTypeOf, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, schemaFieldsOf, getNestedValue, tokenizeOptions, flattenSchema, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, vectorDimensionOf, isSingleStringFieldType, messagePackUpperBoundBytes, extractVectorFieldsFromSchema, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, loadMessagePack, validateRequiredFields, requireDocumentWithinSizeLimit, raiseEarlierReleaseGraphSetting, PROTOTYPE_POLLUTION_KEYS, isPlainObject, isWordIndexedFieldType, loadedMessagePack, validateDocument, validateDocumentStrict, textFieldsChanged, MAX_NESTING_DEPTH, getFlatSchema, getOrCreateFieldNameIndex, isWordIndexedBase, isStringValuedBase, requireValidFieldTypes, parseVectorDimension, isStorageMode, isQuantizationMode, MAX_DOCUMENT_NESTING_DEPTH, 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 } from './chunk-AOLLV37A.mjs';
9
9
  import { withUnpairedSurrogatesReplaced, compareCodePoints, holdsUnpairedSurrogate, defaultSortMode, toComparableSortValue, exceedsCodePoints, SORT_VALUE_MAX_CODE_POINTS, sortModeOf, PLACEMENT_ROOM_REQUESTS, NEAREST_LINK_FALLBACK_HOSTS, MIN_M, MAX_M, MAX_LAYER_CAP, 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, truncateSortString, SORT_MODES, isSortMode, codePointCount } from './chunk-HRDMIQ63.mjs';
10
10
  import { MAX_DOCUMENT_ENCODING_DEPTH, MAX_FILE_BYTES, VALID_HNSW_METRICS, NATIVE_CRC32_MIN_BYTES, CHECKSUM_YIELD_CHUNK_BYTES, DOCUMENT_REPLY_ENVELOPE_DEPTH, DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES, BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER } from './chunk-VUJCSQG5.mjs';
11
11
  import { NarsilError, ErrorCodes, createNarsilError, isNarsilError } from './chunk-43R4GCM7.mjs';
@@ -8682,7 +8682,7 @@ function resolvePartitionInsertOptions(config, analysis, options) {
8682
8682
 
8683
8683
  // src/core/segment-codec-code.ts
8684
8684
  var segmentCodec = codeLoader(async () => {
8685
- const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-PEKX7TBL.mjs')]);
8685
+ const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-PSWHL55A.mjs')]);
8686
8686
  code7.bindSegmentCodecHost(optionalCodeHost(), msgpack);
8687
8687
  return code7;
8688
8688
  }, "segment codec");
@@ -8693,7 +8693,7 @@ var segmentMerge = codeLoader(async () => {
8693
8693
  const [msgpack, codec, code7] = await Promise.all([
8694
8694
  loadMessagePack(),
8695
8695
  loadSegmentCodec(),
8696
- import('./segment-merge-leaf-I2EC7H6R.mjs')
8696
+ import('./segment-merge-leaf-WOJWSDLW.mjs')
8697
8697
  ]);
8698
8698
  code7.bindSegmentMergeHost(optionalCodeHost(), msgpack, codec);
8699
8699
  return code7;
@@ -8702,7 +8702,7 @@ var loadSegmentMerge = segmentMerge.load;
8702
8702
 
8703
8703
  // src/query-suggestions/store-code.ts
8704
8704
  var suggestionStore = codeLoader(async () => {
8705
- const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./store-leaf-EZGCLSLM.mjs')]);
8705
+ const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./store-leaf-K5XG46FV.mjs')]);
8706
8706
  code7.bindSuggestionStoreHost(optionalCodeHost(), msgpack);
8707
8707
  return code7;
8708
8708
  }, "query suggestions store");
@@ -8783,7 +8783,7 @@ var storageCode = codeLoader(async () => {
8783
8783
  loadSegmentMerge(),
8784
8784
  loadSuggestionStore(),
8785
8785
  loadVectorCore(),
8786
- import('./storage-leaf-RQXM7HBO.mjs')
8786
+ import('./storage-leaf-ZUN6Y44X.mjs')
8787
8787
  ]);
8788
8788
  code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
8789
8789
  return code7;
@@ -11585,6 +11585,177 @@ function mergeGroupComponents(components, internalId, contribution) {
11585
11585
  });
11586
11586
  }
11587
11587
 
11588
+ // src/core/partition/top-k-heap.ts
11589
+ function candidateWorse(a, b) {
11590
+ if (a.score < b.score) return true;
11591
+ if (a.score > b.score) return false;
11592
+ return unorderedCandidateWorse(a, b);
11593
+ }
11594
+ function unorderedCandidateWorse(a, b) {
11595
+ return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
11596
+ }
11597
+ function buildMinHeap(heap) {
11598
+ for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
11599
+ siftDown(heap, index);
11600
+ }
11601
+ }
11602
+ function siftDown(heap, start) {
11603
+ const len = heap.length;
11604
+ let current = start;
11605
+ for (; ; ) {
11606
+ let worst = current;
11607
+ const left = 2 * current + 1;
11608
+ const right = 2 * current + 2;
11609
+ if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
11610
+ if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
11611
+ if (worst === current) break;
11612
+ const held = heap[current];
11613
+ heap[current] = heap[worst];
11614
+ heap[worst] = held;
11615
+ current = worst;
11616
+ }
11617
+ }
11618
+ function sortSelection(heap) {
11619
+ heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
11620
+ }
11621
+
11622
+ // src/core/partition/score-buffer.ts
11623
+ var MAX_GENERATION = 2147483647;
11624
+ function createScoreBuffer(capacity) {
11625
+ return {
11626
+ scores: new Float64Array(capacity),
11627
+ stamps: new Int32Array(capacity),
11628
+ touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
11629
+ touchedCount: 0,
11630
+ generation: 0
11631
+ };
11632
+ }
11633
+ function beginScoring(buffer, capacity) {
11634
+ if (buffer.scores.length < capacity) {
11635
+ buffer.scores = new Float64Array(capacity);
11636
+ buffer.stamps = new Int32Array(capacity);
11637
+ buffer.generation = 0;
11638
+ }
11639
+ if (buffer.generation >= MAX_GENERATION) {
11640
+ buffer.stamps.fill(0);
11641
+ buffer.generation = 0;
11642
+ }
11643
+ buffer.generation++;
11644
+ buffer.touchedCount = 0;
11645
+ }
11646
+ function appendTouched(buffer, internalId) {
11647
+ if (buffer.touchedCount === buffer.touched.length) {
11648
+ const grown4 = new Int32Array(buffer.touched.length * 2);
11649
+ grown4.set(buffer.touched);
11650
+ buffer.touched = grown4;
11651
+ }
11652
+ buffer.touched[buffer.touchedCount] = internalId;
11653
+ buffer.touchedCount++;
11654
+ }
11655
+ function addScore(buffer, internalId, termScore) {
11656
+ if (buffer.stamps[internalId] === buffer.generation) {
11657
+ buffer.scores[internalId] += termScore;
11658
+ return;
11659
+ }
11660
+ buffer.stamps[internalId] = buffer.generation;
11661
+ buffer.scores[internalId] = termScore;
11662
+ appendTouched(buffer, internalId);
11663
+ }
11664
+ function markCounted(buffer, internalId) {
11665
+ const countedStamp = -buffer.generation;
11666
+ const stamp = buffer.stamps[internalId];
11667
+ if (stamp === buffer.generation || stamp === countedStamp) return false;
11668
+ buffer.stamps[internalId] = countedStamp;
11669
+ return true;
11670
+ }
11671
+ function kthBestScore(buffer, selection, resolver) {
11672
+ const wanted = selection.length;
11673
+ const { touched, touchedCount, scores } = buffer;
11674
+ let size = 0;
11675
+ let unordered = 0;
11676
+ for (let index = 0; index < touchedCount; index++) {
11677
+ const internalId = touched[index];
11678
+ const score = scores[internalId];
11679
+ if (size === wanted && !(score > selection[0])) continue;
11680
+ if (!resolver.isLive(internalId)) continue;
11681
+ let at = 0;
11682
+ if (size < wanted) {
11683
+ if (Number.isNaN(score)) {
11684
+ unordered++;
11685
+ continue;
11686
+ }
11687
+ at = size++;
11688
+ while (at > 0) {
11689
+ const parent = at - 1 >> 1;
11690
+ if (selection[parent] <= score) break;
11691
+ selection[at] = selection[parent];
11692
+ at = parent;
11693
+ }
11694
+ } else {
11695
+ for (; ; ) {
11696
+ const left = 2 * at + 1;
11697
+ if (left >= size) break;
11698
+ const right = left + 1;
11699
+ const child = right < size && selection[right] < selection[left] ? right : left;
11700
+ if (selection[child] >= score) break;
11701
+ selection[at] = selection[child];
11702
+ at = child;
11703
+ }
11704
+ }
11705
+ selection[at] = score;
11706
+ }
11707
+ if (wanted === 0) return Number.NEGATIVE_INFINITY;
11708
+ if (size === wanted) return selection[0];
11709
+ return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
11710
+ }
11711
+ function hasScore(buffer, internalId) {
11712
+ return buffer.stamps[internalId] === buffer.generation;
11713
+ }
11714
+ function topKFromBuffer(buffer, k, resolver, components) {
11715
+ const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
11716
+ if (wanted <= 0) return [];
11717
+ const heap = [];
11718
+ const { touched, touchedCount, scores } = buffer;
11719
+ let full = false;
11720
+ let threshold = 0;
11721
+ for (let index = 0; index < touchedCount; index++) {
11722
+ const internalId = touched[index];
11723
+ const score = scores[internalId];
11724
+ if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
11725
+ const externalId = resolver.toExternal(internalId);
11726
+ if (externalId === void 0) continue;
11727
+ const candidate = { internalId, externalId, score };
11728
+ if (!full) {
11729
+ heap.push(candidate);
11730
+ if (heap.length === wanted) {
11731
+ buildMinHeap(heap);
11732
+ full = true;
11733
+ threshold = heap[0].score;
11734
+ }
11735
+ continue;
11736
+ }
11737
+ if (candidateWorse(heap[0], candidate)) {
11738
+ heap[0] = candidate;
11739
+ siftDown(heap, 0);
11740
+ threshold = heap[0].score;
11741
+ }
11742
+ }
11743
+ sortSelection(heap);
11744
+ const result = new Array(heap.length);
11745
+ for (let index = 0; index < heap.length; index++) {
11746
+ const entry = heap[index];
11747
+ const record2 = components?.get(entry.internalId);
11748
+ result[index] = {
11749
+ docId: entry.externalId,
11750
+ score: entry.score,
11751
+ termFrequencies: record2?.termFrequencies ?? EMPTY_COMPONENTS,
11752
+ fieldLengths: record2?.fieldLengths ?? EMPTY_COMPONENTS,
11753
+ idf: record2?.idf ?? EMPTY_COMPONENTS
11754
+ };
11755
+ }
11756
+ return result;
11757
+ }
11758
+
11588
11759
  // src/core/partition/group-scoring.ts
11589
11760
  function partialFieldMarks(fieldNames, partialFields) {
11590
11761
  const marks = new Uint8Array(fieldNames.length);
@@ -11638,72 +11809,98 @@ function groupPostingCount(matches) {
11638
11809
  for (const match of matches) total += match.postingList.length;
11639
11810
  return total;
11640
11811
  }
11641
- function computeGroupContributions(context, matches, collect2) {
11642
- const { fields, fieldNames, filterBitset, partialMarks } = context;
11812
+ function scoreMatchPostings(context, match, visit) {
11813
+ const { fields, filterBitset, partialMarks } = context;
11643
11814
  const scoresAreZero = context.totalDocs === 0;
11644
11815
  const onePair = fields.boundPairs.length === 2;
11816
+ const { docIds, termFrequencies, fieldNameIndices, deletedDocs, hasDeleted, count } = postingColumns(
11817
+ match.postingList
11818
+ );
11819
+ let runStart = 0;
11820
+ let runEnd = 0;
11821
+ for (let at = 0; at < count; at++) {
11822
+ const internalId = docIds[at];
11823
+ if (hasDeleted && deletedDocs.has(internalId)) continue;
11824
+ if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
11825
+ let pi = at;
11826
+ if (at < runEnd) {
11827
+ pi = fieldRun.entries[at - runStart];
11828
+ } else if (at + 2 < count && docIds[at + 2] === internalId) {
11829
+ pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
11830
+ runStart = at;
11831
+ runEnd = at + fieldRun.length;
11832
+ }
11833
+ const fieldIndex = fieldNameIndices[pi];
11834
+ if (fields.searchable[fieldIndex] === 0) continue;
11835
+ const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
11836
+ if (factor === 0) continue;
11837
+ const termFrequency = termFrequencies[pi];
11838
+ const fieldBoost = fields.boosts[fieldIndex];
11839
+ const avgLen = fields.averageLengths[fieldIndex];
11840
+ const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
11841
+ const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
11842
+ termFrequency,
11843
+ match.idf,
11844
+ actualFieldLength,
11845
+ avgLen,
11846
+ onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
11847
+ onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
11848
+ )) * fieldBoost * factor;
11849
+ visit(internalId, fieldIndex, termFrequency, actualFieldLength, termScore);
11850
+ }
11851
+ }
11852
+ var termScores = null;
11853
+ var bestScores = null;
11854
+ function addGroupScores(context, matches, target, only, coverage) {
11855
+ const best = bestGroupScores(context, matches, target.scores.length);
11856
+ for (let index = 0; index < best.touchedCount; index++) {
11857
+ const internalId = best.touched[index];
11858
+ if (only !== null && !bitsetHas(only, internalId)) continue;
11859
+ coverage?.mark(internalId);
11860
+ addScore(target, internalId, best.scores[internalId]);
11861
+ }
11862
+ }
11863
+ function bestGroupScores(context, matches, capacity) {
11864
+ termScores ??= createScoreBuffer(capacity);
11865
+ bestScores ??= createScoreBuffer(capacity);
11866
+ const perTerm = termScores;
11867
+ const best = bestScores;
11868
+ const addTermScore = (internalId, _fieldIndex, _termFrequency, _fieldLength, termScore) => addScore(perTerm, internalId, termScore);
11869
+ beginScoring(best, capacity);
11870
+ for (const match of matches) {
11871
+ beginScoring(perTerm, capacity);
11872
+ scoreMatchPostings(context, match, addTermScore);
11873
+ for (let index = 0; index < perTerm.touchedCount; index++) {
11874
+ const internalId = perTerm.touched[index];
11875
+ const score = perTerm.scores[internalId];
11876
+ if (!hasScore(best, internalId)) addScore(best, internalId, score);
11877
+ else if (compareScores(score, best.scores[internalId]) < 0) best.scores[internalId] = score;
11878
+ }
11879
+ }
11880
+ return best;
11881
+ }
11882
+ function computeGroupContributions(context, matches) {
11883
+ const { fieldNames } = context;
11645
11884
  const best = /* @__PURE__ */ new Map();
11646
11885
  for (const match of matches) {
11647
11886
  const perTerm = /* @__PURE__ */ new Map();
11648
- const { docIds, termFrequencies, fieldNameIndices, deletedDocs, hasDeleted, count } = postingColumns(
11649
- match.postingList
11650
- );
11651
- let runStart = 0;
11652
- let runEnd = 0;
11653
- for (let at = 0; at < count; at++) {
11654
- const internalId = docIds[at];
11655
- if (hasDeleted && deletedDocs.has(internalId)) continue;
11656
- if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
11657
- let pi = at;
11658
- if (at < runEnd) {
11659
- pi = fieldRun.entries[at - runStart];
11660
- } else if (at + 2 < count && docIds[at + 2] === internalId) {
11661
- pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
11662
- runStart = at;
11663
- runEnd = at + fieldRun.length;
11664
- }
11665
- const fieldIndex = fieldNameIndices[pi];
11666
- if (fields.searchable[fieldIndex] === 0) continue;
11667
- const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
11668
- if (factor === 0) continue;
11887
+ scoreMatchPostings(context, match, (internalId, fieldIndex, termFrequency, actualFieldLength, termScore) => {
11669
11888
  const fieldName = fieldNames[fieldIndex];
11670
- const termFrequency = termFrequencies[pi];
11671
- const fieldBoost = fields.boosts[fieldIndex];
11672
- const avgLen = fields.averageLengths[fieldIndex];
11673
- const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
11674
- const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
11675
- termFrequency,
11676
- match.idf,
11677
- actualFieldLength,
11678
- avgLen,
11679
- onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
11680
- onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
11681
- )) * fieldBoost * factor;
11682
11889
  const existing = perTerm.get(internalId);
11683
11890
  if (existing) {
11684
11891
  existing.score += termScore;
11685
- if (collect2) {
11686
- existing.termFrequencies[`${fieldName}:${match.token}`] = termFrequency;
11687
- existing.fieldLengths[fieldName] = actualFieldLength;
11688
- }
11689
- } else if (collect2) {
11690
- perTerm.set(internalId, {
11691
- score: termScore,
11692
- token: match.token,
11693
- idf: match.idf,
11694
- termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
11695
- fieldLengths: { [fieldName]: actualFieldLength }
11696
- });
11697
- } else {
11698
- perTerm.set(internalId, {
11699
- score: termScore,
11700
- token: match.token,
11701
- idf: match.idf,
11702
- termFrequencies: EMPTY_COMPONENTS,
11703
- fieldLengths: EMPTY_COMPONENTS
11704
- });
11892
+ existing.termFrequencies[`${fieldName}:${match.token}`] = termFrequency;
11893
+ existing.fieldLengths[fieldName] = actualFieldLength;
11894
+ return;
11705
11895
  }
11706
- }
11896
+ perTerm.set(internalId, {
11897
+ score: termScore,
11898
+ token: match.token,
11899
+ idf: match.idf,
11900
+ termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
11901
+ fieldLengths: { [fieldName]: actualFieldLength }
11902
+ });
11903
+ });
11707
11904
  for (const [internalId, contribution] of perTerm) {
11708
11905
  const current = best.get(internalId);
11709
11906
  if (!current || compareScores(contribution.score, current.score) < 0) {
@@ -12230,177 +12427,6 @@ function blockBoundsFor(list, columns2) {
12230
12427
  return built2;
12231
12428
  }
12232
12429
 
12233
- // src/core/partition/top-k-heap.ts
12234
- function candidateWorse(a, b) {
12235
- if (a.score < b.score) return true;
12236
- if (a.score > b.score) return false;
12237
- return unorderedCandidateWorse(a, b);
12238
- }
12239
- function unorderedCandidateWorse(a, b) {
12240
- return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
12241
- }
12242
- function buildMinHeap(heap) {
12243
- for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
12244
- siftDown(heap, index);
12245
- }
12246
- }
12247
- function siftDown(heap, start) {
12248
- const len = heap.length;
12249
- let current = start;
12250
- for (; ; ) {
12251
- let worst = current;
12252
- const left = 2 * current + 1;
12253
- const right = 2 * current + 2;
12254
- if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
12255
- if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
12256
- if (worst === current) break;
12257
- const held = heap[current];
12258
- heap[current] = heap[worst];
12259
- heap[worst] = held;
12260
- current = worst;
12261
- }
12262
- }
12263
- function sortSelection(heap) {
12264
- heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
12265
- }
12266
-
12267
- // src/core/partition/score-buffer.ts
12268
- var MAX_GENERATION = 2147483647;
12269
- function createScoreBuffer(capacity) {
12270
- return {
12271
- scores: new Float64Array(capacity),
12272
- stamps: new Int32Array(capacity),
12273
- touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
12274
- touchedCount: 0,
12275
- generation: 0
12276
- };
12277
- }
12278
- function beginScoring(buffer, capacity) {
12279
- if (buffer.scores.length < capacity) {
12280
- buffer.scores = new Float64Array(capacity);
12281
- buffer.stamps = new Int32Array(capacity);
12282
- buffer.generation = 0;
12283
- }
12284
- if (buffer.generation >= MAX_GENERATION) {
12285
- buffer.stamps.fill(0);
12286
- buffer.generation = 0;
12287
- }
12288
- buffer.generation++;
12289
- buffer.touchedCount = 0;
12290
- }
12291
- function appendTouched(buffer, internalId) {
12292
- if (buffer.touchedCount === buffer.touched.length) {
12293
- const grown4 = new Int32Array(buffer.touched.length * 2);
12294
- grown4.set(buffer.touched);
12295
- buffer.touched = grown4;
12296
- }
12297
- buffer.touched[buffer.touchedCount] = internalId;
12298
- buffer.touchedCount++;
12299
- }
12300
- function addScore(buffer, internalId, termScore) {
12301
- if (buffer.stamps[internalId] === buffer.generation) {
12302
- buffer.scores[internalId] += termScore;
12303
- return;
12304
- }
12305
- buffer.stamps[internalId] = buffer.generation;
12306
- buffer.scores[internalId] = termScore;
12307
- appendTouched(buffer, internalId);
12308
- }
12309
- function markCounted(buffer, internalId) {
12310
- const countedStamp = -buffer.generation;
12311
- const stamp = buffer.stamps[internalId];
12312
- if (stamp === buffer.generation || stamp === countedStamp) return false;
12313
- buffer.stamps[internalId] = countedStamp;
12314
- return true;
12315
- }
12316
- function kthBestScore(buffer, selection, resolver) {
12317
- const wanted = selection.length;
12318
- const { touched, touchedCount, scores } = buffer;
12319
- let size = 0;
12320
- let unordered = 0;
12321
- for (let index = 0; index < touchedCount; index++) {
12322
- const internalId = touched[index];
12323
- const score = scores[internalId];
12324
- if (size === wanted && !(score > selection[0])) continue;
12325
- if (!resolver.isLive(internalId)) continue;
12326
- let at = 0;
12327
- if (size < wanted) {
12328
- if (Number.isNaN(score)) {
12329
- unordered++;
12330
- continue;
12331
- }
12332
- at = size++;
12333
- while (at > 0) {
12334
- const parent = at - 1 >> 1;
12335
- if (selection[parent] <= score) break;
12336
- selection[at] = selection[parent];
12337
- at = parent;
12338
- }
12339
- } else {
12340
- for (; ; ) {
12341
- const left = 2 * at + 1;
12342
- if (left >= size) break;
12343
- const right = left + 1;
12344
- const child = right < size && selection[right] < selection[left] ? right : left;
12345
- if (selection[child] >= score) break;
12346
- selection[at] = selection[child];
12347
- at = child;
12348
- }
12349
- }
12350
- selection[at] = score;
12351
- }
12352
- if (wanted === 0) return Number.NEGATIVE_INFINITY;
12353
- if (size === wanted) return selection[0];
12354
- return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
12355
- }
12356
- function hasScore(buffer, internalId) {
12357
- return buffer.stamps[internalId] === buffer.generation;
12358
- }
12359
- function topKFromBuffer(buffer, k, resolver, components) {
12360
- const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
12361
- if (wanted <= 0) return [];
12362
- const heap = [];
12363
- const { touched, touchedCount, scores } = buffer;
12364
- let full = false;
12365
- let threshold = 0;
12366
- for (let index = 0; index < touchedCount; index++) {
12367
- const internalId = touched[index];
12368
- const score = scores[internalId];
12369
- if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
12370
- const externalId = resolver.toExternal(internalId);
12371
- if (externalId === void 0) continue;
12372
- const candidate = { internalId, externalId, score };
12373
- if (!full) {
12374
- heap.push(candidate);
12375
- if (heap.length === wanted) {
12376
- buildMinHeap(heap);
12377
- full = true;
12378
- threshold = heap[0].score;
12379
- }
12380
- continue;
12381
- }
12382
- if (candidateWorse(heap[0], candidate)) {
12383
- heap[0] = candidate;
12384
- siftDown(heap, 0);
12385
- threshold = heap[0].score;
12386
- }
12387
- }
12388
- sortSelection(heap);
12389
- const result = new Array(heap.length);
12390
- for (let index = 0; index < heap.length; index++) {
12391
- const entry = heap[index];
12392
- const record2 = components?.get(entry.internalId);
12393
- result[index] = {
12394
- docId: entry.externalId,
12395
- score: entry.score,
12396
- termFrequencies: record2?.termFrequencies ?? EMPTY_COMPONENTS,
12397
- fieldLengths: record2?.fieldLengths ?? EMPTY_COMPONENTS,
12398
- idf: record2?.idf ?? EMPTY_COMPONENTS
12399
- };
12400
- }
12401
- return result;
12402
- }
12403
-
12404
12430
  // src/core/partition/multi-term-topk.ts
12405
12431
  function prunableMultiTermLists(params, index) {
12406
12432
  if (params.queryTokens.length < 2) return null;
@@ -13043,10 +13069,14 @@ function searchFulltext(state, params) {
13043
13069
  }
13044
13070
  function scoreGroup(group, only) {
13045
13071
  if (group === null) return;
13046
- for (const [internalId, contribution] of computeGroupContributions(groupContext, group, collectComponents)) {
13047
- if (only !== null && !bitsetHas(only, internalId)) continue;
13048
- mergeGroupContribution(internalId, contribution);
13072
+ if (components !== null) {
13073
+ for (const [internalId, contribution] of computeGroupContributions(groupContext, group)) {
13074
+ if (only !== null && !bitsetHas(only, internalId)) continue;
13075
+ mergeGroupContribution(internalId, contribution);
13076
+ }
13077
+ return;
13049
13078
  }
13079
+ addGroupScores(groupContext, group, scoreBuffer, only, coverage);
13050
13080
  }
13051
13081
  const prunableList = phrases === void 0 ? prunableSingleTermList(params, state.invertedIdx, fieldNames) : null;
13052
13082
  if (prunableList !== null && maxResults !== void 0) {
@@ -17120,11 +17150,13 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
17120
17150
  isTombstoned: (ordinal) => tombstones.has(ordinal),
17121
17151
  settleRemovals: counts.settleRemovals
17122
17152
  });
17123
- const textDocuments = {
17124
- count: documentSource.count,
17125
- textFields: source.fieldLengthNames,
17126
- documentAt: (ordinal) => documentSource.readAt(ordinal)
17153
+ const textFieldsOnly = {
17154
+ kind: "fields",
17155
+ include: source.fieldLengthNames.map((fieldPath) => fieldPath.split(".")),
17156
+ exclude: []
17127
17157
  };
17158
+ const textAt2 = (ordinal) => documentSource.readAt(ordinal, textFieldsOnly);
17159
+ const textDocuments = { count: documentSource.count, textFields: source.fieldLengthNames, documentAt: textAt2 };
17128
17160
  const loadSurfaceForms = survivingSurfaceForms === void 0 ? source.readSurfaceForms : () => survivingSurfaceForms;
17129
17161
  const surfaces = createFrozenSurfaceSlot(
17130
17162
  loadSurfaceForms,
@@ -17196,7 +17228,7 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
17196
17228
  source.fieldNames,
17197
17229
  source.fieldLengthNames,
17198
17230
  ordinal,
17199
- documentSource.readAt(ordinal),
17231
+ textAt2(ordinal),
17200
17232
  analysis,
17201
17233
  surfaces,
17202
17234
  partialWords
@@ -18140,11 +18172,12 @@ function bindSegmentCodecHost(_host, _msgpack) {
18140
18172
  // src/serialization/msgpack-without-fields.ts
18141
18173
  var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
18142
18174
  var keyDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
18175
+ var walkedHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
18143
18176
  function endOfValue(view, start) {
18144
18177
  let offset = start;
18145
18178
  let pending = 1;
18146
18179
  while (pending > 0) {
18147
- const header = headerAt(view, offset);
18180
+ const header = headerAt(view, offset, walkedHeader);
18148
18181
  if (header === null) return null;
18149
18182
  offset += header.headerBytes + header.bodyBytes;
18150
18183
  if (offset > view.byteLength) return null;
@@ -18213,6 +18246,8 @@ function decodeMapWithoutFields(bytes, skippedFields) {
18213
18246
  var encoder5 = new TextEncoder();
18214
18247
  var PROTO_KEY_BYTES = encoder5.encode("__proto__");
18215
18248
  var MISSING = { found: false, value: void 0 };
18249
+ var mapHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
18250
+ var keyHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
18216
18251
  var pathDecoder = null;
18217
18252
  function encodePathSegments(segments2) {
18218
18253
  if (segments2.length === 0) return null;
@@ -18239,14 +18274,12 @@ function sameBytes(bytes, start, end, target) {
18239
18274
  }
18240
18275
  return true;
18241
18276
  }
18242
- function keyRangeAt(view, offset) {
18243
- if (!isStringTag(view.getUint8(offset))) return null;
18244
- const header = headerAt(view, offset);
18245
- if (header === null) return null;
18246
- const start = offset + header.headerBytes;
18247
- return { start, end: start + header.bodyBytes };
18277
+ function keyEndAt(view, offset) {
18278
+ if (!isStringTag(view.getUint8(offset))) return -1;
18279
+ if (headerAt(view, offset, keyHeader) === null) return -1;
18280
+ return offset + keyHeader.headerBytes + keyHeader.bodyBytes;
18248
18281
  }
18249
- function readEncodedPath(bytes, segments2, arrays) {
18282
+ function readEncodedPath(bytes, segments2, arrays, foundRead) {
18250
18283
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
18251
18284
  let start = 0;
18252
18285
  let end = bytes.length;
@@ -18258,20 +18291,21 @@ function readEncodedPath(bytes, segments2, arrays) {
18258
18291
  if (isArrayTag(tag2)) return arrays === "missing" ? MISSING : null;
18259
18292
  return isScalarTag(tag2) ? MISSING : null;
18260
18293
  }
18261
- const header = headerAt(view, start);
18262
- if (header === null) return null;
18263
- let offset = start + header.headerBytes;
18294
+ if (headerAt(view, start, mapHeader) === null) return null;
18295
+ const pairs = mapHeader.children / 2;
18296
+ let offset = start + mapHeader.headerBytes;
18264
18297
  let valueStart = -1;
18265
18298
  let valueEnd = -1;
18266
- for (let pair = 0; pair < header.children / 2; pair++) {
18299
+ for (let pair = 0; pair < pairs; pair++) {
18267
18300
  if (offset >= end) return null;
18268
- const key = keyRangeAt(view, offset);
18269
- if (key === null || key.end > end) return null;
18270
- if (sameBytes(bytes, key.start, key.end, PROTO_KEY_BYTES)) return null;
18271
- const next = endOfValue(view, key.end);
18301
+ const keyEnd = keyEndAt(view, offset);
18302
+ if (keyEnd < 0 || keyEnd > end) return null;
18303
+ const keyStart = offset + keyHeader.headerBytes;
18304
+ if (sameBytes(bytes, keyStart, keyEnd, PROTO_KEY_BYTES)) return null;
18305
+ const next = endOfValue(view, keyEnd);
18272
18306
  if (next === null || next > end) return null;
18273
- if (sameBytes(bytes, key.start, key.end, segments2[depth])) {
18274
- valueStart = key.end;
18307
+ if (sameBytes(bytes, keyStart, keyEnd, segments2[depth])) {
18308
+ valueStart = keyEnd;
18275
18309
  valueEnd = next;
18276
18310
  }
18277
18311
  offset = next;
@@ -18283,7 +18317,8 @@ function readEncodedPath(bytes, segments2, arrays) {
18283
18317
  }
18284
18318
  try {
18285
18319
  pathDecoder ??= new Decoder();
18286
- return { found: true, value: pathDecoder.decode(bytes.subarray(start, end)) };
18320
+ foundRead.value = pathDecoder.decode(bytes.subarray(start, end));
18321
+ return foundRead;
18287
18322
  } catch {
18288
18323
  return null;
18289
18324
  }
@@ -18379,20 +18414,35 @@ function wrapEncodedDocumentTable(data) {
18379
18414
  }
18380
18415
  function createEncodedDocumentSource(count, byteLength, bytesAt, discardedFields) {
18381
18416
  const discarded = (discardedFields ?? []).map((fieldPath) => fieldPath.split("."));
18382
- const touchesDiscarded = (path) => discarded.some((discardedPath) => sharesPrefix(discardedPath, path));
18417
+ const touchesDiscarded = (path) => {
18418
+ for (const discardedPath of discarded) {
18419
+ if (sharesPrefix(discardedPath, path)) return true;
18420
+ }
18421
+ return false;
18422
+ };
18383
18423
  const docAt = (ordinal) => documentWithOwnBuffers(decodeStoredDocument(bytesAt(ordinal), discardedFields));
18384
- function projectedPathAt(ordinal, path) {
18424
+ function projectedPathAt(ordinal, path, result) {
18385
18425
  const segments2 = encodedProjectionPathOf(path);
18386
18426
  if (segments2 === null) return { found: false, value: void 0 };
18387
- const read = touchesDiscarded(path) ? null : readEncodedPath(bytesAt(ordinal), segments2, "missing");
18427
+ const read = touchesDiscarded(path) ? null : readEncodedPath(bytesAt(ordinal), segments2, "missing", result);
18388
18428
  if (read === null) return readProjectedPath(docAt(ordinal), path);
18389
- return read.found ? { found: true, value: valueWithOwnBuffers(read.value) } : read;
18429
+ if (!read.found) return read;
18430
+ read.value = valueWithOwnBuffers(read.value);
18431
+ return read;
18432
+ }
18433
+ function projectedAt(ordinal, projection) {
18434
+ if (projection === void 0 || projection.kind === "full") return docAt(ordinal);
18435
+ if (projection.kind === "none") return {};
18436
+ if (projection.include === null) return cloneProjected(docAt(ordinal), projection);
18437
+ const result = { found: true, value: void 0 };
18438
+ return projectIncludedPaths(projection.include, projection.exclude, (path) => projectedPathAt(ordinal, path, result));
18390
18439
  }
18391
18440
  return {
18392
18441
  count,
18393
18442
  byteLength,
18394
18443
  docAt,
18395
- readAt(ordinal) {
18444
+ readAt(ordinal, fields) {
18445
+ if (fields !== void 0) return projectedAt(ordinal, fields);
18396
18446
  return decodeStoredDocument(bytesAt(ordinal), discardedFields);
18397
18447
  },
18398
18448
  fieldReader(fieldPath) {
@@ -18401,16 +18451,15 @@ function createEncodedDocumentSource(count, byteLength, bytesAt, discardedFields
18401
18451
  if (segments2 === null) return () => void 0;
18402
18452
  const decodesDocument = touchesDiscarded(path);
18403
18453
  return (ordinal) => {
18404
- const read = decodesDocument ? null : readEncodedPath(bytesAt(ordinal), segments2, "decode-document");
18454
+ const read = decodesDocument ? null : readEncodedPath(bytesAt(ordinal), segments2, "decode-document", { found: true, value: void 0 });
18405
18455
  if (read !== null) return valueWithOwnBuffers(read.value);
18406
18456
  return getNestedValue(docAt(ordinal), fieldPath);
18407
18457
  };
18408
18458
  },
18409
- projectedAt(ordinal, projection) {
18410
- if (projection === void 0 || projection.kind === "full") return docAt(ordinal);
18411
- if (projection.kind === "none") return {};
18412
- if (projection.include === null) return cloneProjected(docAt(ordinal), projection);
18413
- return projectIncludedPaths(projection.include, projection.exclude, (path) => projectedPathAt(ordinal, path));
18459
+ projectedAt,
18460
+ copyForRollbackAt(ordinal) {
18461
+ const bytes = bytesAt(ordinal).slice();
18462
+ return () => documentWithOwnBuffers(decodeStoredDocument(bytes, discardedFields));
18414
18463
  }
18415
18464
  };
18416
18465
  }
@@ -19946,7 +19995,7 @@ function hasLanguage(name) {
19946
19995
 
19947
19996
  // src/narsil/restore-queue-code.ts
19948
19997
  var restoreQueue = codeLoader(async () => {
19949
- const [suggestionStore2, code7] = await Promise.all([loadSuggestionStore(), import('./restore-queue-J7SB263E.mjs')]);
19998
+ const [suggestionStore2, code7] = await Promise.all([loadSuggestionStore(), import('./restore-queue-MVJTP3E4.mjs')]);
19950
19999
  code7.bindRestoreQueueHost(optionalCodeHost(), suggestionStore2);
19951
20000
  return code7;
19952
20001
  }, "restore");
@@ -20511,6 +20560,32 @@ function createSharedFrozenSegment(snapshot, survivingSurfaceForms) {
20511
20560
  );
20512
20561
  }
20513
20562
 
20563
+ // src/partitioning/manager/nested-values.ts
20564
+ function setNestedValue(obj, path, value) {
20565
+ if (!path.includes(".")) {
20566
+ obj[path] = value;
20567
+ return;
20568
+ }
20569
+ const segments2 = path.split(".");
20570
+ let current = obj;
20571
+ for (let i = 0; i < segments2.length - 1; i++) {
20572
+ let next = current[segments2[i]];
20573
+ if (next === null || next === void 0 || typeof next !== "object") {
20574
+ next = {};
20575
+ current[segments2[i]] = next;
20576
+ }
20577
+ current = next;
20578
+ }
20579
+ current[segments2[segments2.length - 1]] = value;
20580
+ }
20581
+ function copyVectorsInto(document, docId, vectorIndexes, projection) {
20582
+ for (const [fieldPath, vectorIndex] of vectorIndexes) {
20583
+ if (projection !== void 0 && !projectionKeepsField(projection, fieldPath)) continue;
20584
+ const vector = vectorIndex.getVector(docId);
20585
+ if (vector) setNestedValue(document, fieldPath, vector);
20586
+ }
20587
+ }
20588
+
20514
20589
  // src/sync/epoch.ts
20515
20590
  var SYNC_EPOCH_BYTES = 16;
20516
20591
  var SYNC_EPOCH_PATTERN = /^[0-9a-f]{32}$/;
@@ -20548,7 +20623,7 @@ var loadEmbedCode = embedCode.load;
20548
20623
 
20549
20624
  // src/engine/optional-writes-code.ts
20550
20625
  var optionalWrites = codeLoader(async () => {
20551
- const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-LZDHB7FX.mjs')]);
20626
+ const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-MGFFGKYQ.mjs')]);
20552
20627
  code7.bindOptionalWritesHost(optionalCodeHost(), segmentCodec2);
20553
20628
  return code7;
20554
20629
  }, "write");
@@ -21454,7 +21529,7 @@ async function rollbackRemovedDocument(ctx, indexName, docId, restoreDoc, origin
21454
21529
  await manager.publication.write(
21455
21530
  () => changeIndexOutsideExternalWaits(async () => {
21456
21531
  if (manager.has(docId)) return;
21457
- const previous = prepareDocumentVectors(restoreDoc, ctx.requireIndex(indexName).vectorFieldPaths);
21532
+ const previous = prepareDocumentVectors(restoreDoc(), ctx.requireIndex(indexName).vectorFieldPaths);
21458
21533
  manager.insert(docId, previous.partitionDoc, {
21459
21534
  preparedText: { after: preparedText?.before }
21460
21535
  });
@@ -22151,6 +22226,36 @@ async function insertDocumentBatch(ctx, indexName, documents2, options, hold) {
22151
22226
  return { succeeded: inserts.succeeded, failed };
22152
22227
  }
22153
22228
 
22229
+ // src/engine/mutations/rollback-copy.ts
22230
+ function frozenRollbackCopy(manager, docId) {
22231
+ const partitionId = manager.partitionIdOf(docId);
22232
+ if (partitionId === void 0) return void 0;
22233
+ const partition = manager.getPartition(partitionId);
22234
+ if (!isCompositePartition(partition)) return void 0;
22235
+ for (const segment of partition.frozenSegments()) {
22236
+ const ordinal = segment.docStore.getInternalId(docId);
22237
+ if (ordinal !== void 0) return segment.documentSource.copyForRollbackAt?.(ordinal);
22238
+ }
22239
+ return void 0;
22240
+ }
22241
+ function rollbackCopyOf(manager, docId) {
22242
+ const frozenCopy = frozenRollbackCopy(manager, docId);
22243
+ if (frozenCopy === void 0) {
22244
+ const document = manager.get(docId);
22245
+ return document === void 0 ? void 0 : () => document;
22246
+ }
22247
+ const vectors = [];
22248
+ for (const [fieldPath, vectorIndex] of manager.getVectorIndexes()) {
22249
+ const vector = vectorIndex.getVector(docId);
22250
+ if (vector) vectors.push([fieldPath, vector]);
22251
+ }
22252
+ return () => {
22253
+ const document = frozenCopy();
22254
+ for (const [fieldPath, vector] of vectors) setNestedValue(document, fieldPath, vector);
22255
+ return document;
22256
+ };
22257
+ }
22258
+
22154
22259
  // src/engine/mutations/remove.ts
22155
22260
  function asRemoveError(ctx, err) {
22156
22261
  return batchFailureOf(ctx, err, ErrorCodes.DOC_NOT_FOUND);
@@ -22189,7 +22294,7 @@ function applyOfRemoval(ctx, indexName, prepared) {
22189
22294
  prepared.buffered = true;
22190
22295
  return queued;
22191
22296
  }
22192
- prepared.restoreDoc = ctx.durability ? manager.get(docId) : void 0;
22297
+ prepared.restoreDoc = ctx.durability ? rollbackCopyOf(manager, docId) : void 0;
22193
22298
  if (ctx.durability !== null) prepared.releaseVectorHolds = holdVectorsForRollback(manager.getVectorIndexes(), docId);
22194
22299
  manager.remove(docId, void 0, {
22195
22300
  onRemovedSpellings: (spellings) => {
@@ -22887,7 +22992,7 @@ var suggestionsCode = codeLoader(async () => {
22887
22992
  const [msgpack, suggestionStore2, code7] = await Promise.all([
22888
22993
  loadMessagePack(),
22889
22994
  loadSuggestionStore(),
22890
- import('./suggestions-leaf-JNGH2JYC.mjs')
22995
+ import('./suggestions-leaf-KDPM3P27.mjs')
22891
22996
  ]);
22892
22997
  code7.bindSuggestionsHost(optionalCodeHost(), msgpack, suggestionStore2);
22893
22998
  return code7;
@@ -23231,32 +23336,6 @@ function createDocumentWrites(source) {
23231
23336
  };
23232
23337
  }
23233
23338
 
23234
- // src/partitioning/manager/nested-values.ts
23235
- function setNestedValue(obj, path, value) {
23236
- if (!path.includes(".")) {
23237
- obj[path] = value;
23238
- return;
23239
- }
23240
- const segments2 = path.split(".");
23241
- let current = obj;
23242
- for (let i = 0; i < segments2.length - 1; i++) {
23243
- let next = current[segments2[i]];
23244
- if (next === null || next === void 0 || typeof next !== "object") {
23245
- next = {};
23246
- current[segments2[i]] = next;
23247
- }
23248
- current = next;
23249
- }
23250
- current[segments2[segments2.length - 1]] = value;
23251
- }
23252
- function copyVectorsInto(document, docId, vectorIndexes, projection) {
23253
- for (const [fieldPath, vectorIndex] of vectorIndexes) {
23254
- if (projection !== void 0 && !projectionKeepsField(projection, fieldPath)) continue;
23255
- const vector = vectorIndex.getVector(docId);
23256
- if (vector) setNestedValue(document, fieldPath, vector);
23257
- }
23258
- }
23259
-
23260
23339
  // src/core/stored-values/references.ts
23261
23340
  var documents = /* @__PURE__ */ new WeakMap();
23262
23341
  function documentStoredFields(document, fields) {
@@ -24514,7 +24593,7 @@ var workerCopies = codeLoader(async () => {
24514
24593
  const [segmentCodec2, segmentMerge2, code7] = await Promise.all([
24515
24594
  loadSegmentCodec(),
24516
24595
  loadSegmentMerge(),
24517
- import('./worker-copies-2OWLLBCV.mjs')
24596
+ import('./worker-copies-FVFMBBH6.mjs')
24518
24597
  ]);
24519
24598
  code7.bindWorkerCopiesHost(optionalCodeHost(), segmentCodec2, segmentMerge2);
24520
24599
  return code7;
@@ -24689,6 +24768,7 @@ function writesHostPart() {
24689
24768
  requireDocumentWithinSizeLimit,
24690
24769
  requireMatchingDocId,
24691
24770
  requireSurfaceFormsForPartialFields,
24771
+ setNestedValue,
24692
24772
  storedBM25Params,
24693
24773
  turnsAreBudgeted,
24694
24774
  updateDocumentVectors,