@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,10 +1,10 @@
1
1
  import { encodeDocument } from './chunk-2CKDCC65.mjs';
2
2
  import { workerResourceLimits, admittedHeapBytes, collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal } from './chunk-2AFZE7Y3.mjs';
3
- import { headerAt, MAP_TAGS, decode, Decoder } from './chunk-5GYGHPCH.mjs';
3
+ import { headerAt, MAP_TAGS, decode, Decoder } from './chunk-Y7GXGJFZ.mjs';
4
4
  import { newSyncEpoch, isSyncEpoch } from './chunk-BUMREPLU.mjs';
5
5
  import { english } from './chunk-7T4LAYT4.mjs';
6
- import { patternSearchModule, PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, matchPattern, claimsTypoPreparation, DEFAULT_PATTERN_WORK_CAP, bitsetHas, bitsetClear, storedText, cachedStoredFields, storedValuesOf, bitsetSet, discardStoredValues, MAX_FILTER_DEPTH, createBitSet, installStoredFields, storedValueBytes, bitsetIterator, bitsetIsEmpty, prepareStoredValues, fuzzyTermMatches, MATCHER_STATE_BUDGET_BYTES, GrowableUint32, checkedSize, buildStoredValues, bitsetFromSet, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, fuzzyPrefixOf, boundedLevenshtein, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, FILTER_OPERAND_COPY_DEPTH, PATTERN_WORK_FLUSH_UNITS } from './chunk-KQWTS7AM.mjs';
7
- import { parsedTypeOf, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, isStringValuedBase, flattenSchema, schemaFieldsOf, getNestedValue, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, requireLoadedMessagePack, vectorDimensionOf, isSingleStringFieldType, messagePackUpperBoundBytes, extractVectorFieldsFromSchema, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, loadMessagePack, validateRequiredFields, requireDocumentWithinSizeLimit, raiseEarlierReleaseGraphSetting, isWordIndexedBase, PROTOTYPE_POLLUTION_KEYS, tokenizeOptions, isPlainObject, isWordIndexedFieldType, loadedMessagePack, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, getOrCreateFieldNameIndex, MAX_NESTING_DEPTH, 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-4WQNWAQE.mjs';
6
+ import { patternSearchModule, PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, matchPattern, claimsTypoPreparation, DEFAULT_PATTERN_WORK_CAP, bitsetHas, bitsetClear, storedText, cachedStoredFields, storedValuesOf, bitsetSet, discardStoredValues, MAX_FILTER_DEPTH, createBitSet, installStoredFields, storedValueBytes, bitsetIterator, bitsetIsEmpty, prepareStoredValues, fuzzyTermMatches, MATCHER_STATE_BUDGET_BYTES, GrowableUint32, checkedSize, buildStoredValues, bitsetFromSet, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, fuzzyPrefixOf, boundedLevenshtein, bitsetAndNotInto, bitsetAndInto, bitsetOrInto, FILTER_OPERAND_COPY_DEPTH, PATTERN_WORK_FLUSH_UNITS } from './chunk-4JLHHEBN.mjs';
7
+ import { parsedTypeOf, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, isStringValuedBase, flattenSchema, schemaFieldsOf, getNestedValue, partialFieldsOf, MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, requireLoadedMessagePack, vectorDimensionOf, isSingleStringFieldType, messagePackUpperBoundBytes, extractVectorFieldsFromSchema, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, loadMessagePack, validateRequiredFields, requireDocumentWithinSizeLimit, raiseEarlierReleaseGraphSetting, isWordIndexedBase, PROTOTYPE_POLLUTION_KEYS, tokenizeOptions, isPlainObject, isWordIndexedFieldType, loadedMessagePack, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, getOrCreateFieldNameIndex, MAX_NESTING_DEPTH, 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-EY5U4P5V.mjs';
8
8
  import { detectRuntime, splitWorkerBudget, resolveWorkerCount, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, countEngineThread, requirePinnedState, createDocIdMap, SHUTDOWN_TIMEOUT_MS, stopOfSignal, requireSearchActive, resolveWorkerEntry, missingWorkerEntry, signalOfSearch, answerFromOneState, sharedStopOfSignal, engineThreadYoungGenerationBytes, resolveRequestThreadCount, spawnNodeWorker, bindSearchSignal, WORKER_YOUNG_GENERATION_MB, nodeThreadId, youngGenerationBytesOfThisV8 } from './chunk-FJXJZUWF.mjs';
9
9
  import { changeIndexOutsideExternalWaits, turnsAreBudgeted, turnIsSpent, yieldTurn, HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, noteThreadSlotLive, threadSlotOfWorker, indexChangeOutsideExternalWaits, PROCESS_LIMIT_REFRESH_INTERVAL_MS, countWrite, PROCESS_STATUS_READ_BYTES, PROCESS_STATUS_READ_CEILING_BYTES, threadSlotGone, noteThreadSlotGone, adoptSharedTurns, 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, collectAndReturnPages } from './chunk-5EI5CXO6.mjs';
10
10
  import { MIN_DOCUMENTS_FOR_SEGMENTS, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, RESULT_WINDOW, PARTIAL_WORD_MIN_CODE_POINTS, PARTIAL_WORDS_ADDED_PER_QUERY, MAX_PARTITIONS, DEFAULT_LIMIT, MAX_INDEX_CONFIGURATION_BYTES, BATCH_CHUNK_SIZE, DEFAULT_FUZZY_PREFIX_LENGTH, BM25_DISPLAYED_NAME_LENGTH, MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, MAX_DOC_ID_LENGTH, MAX_CALLS_ACROSS_INDEX_CHANGES, DEFAULT_PAGE_SIZE, CURSOR_BINDING_BUFFER_BYTES, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, MAX_SWEEP_INTERVAL_MS, DEFAULT_OFFSET, MIN_SWEEP_INTERVAL_MS, 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, HEAP_PRESSURE_WARNING_FRACTION, PREFIX_MAX_EXPANSIONS, HEAP_PRESSURE_REARM_FRACTION, MAX_TOLERANCE, MAX_PREFIX_LENGTH } from './chunk-3ECIRFS5.mjs';
@@ -12686,7 +12686,7 @@ function resolvePartitionInsertOptions(config, analysis, options) {
12686
12686
 
12687
12687
  // src/core/segment-codec-code.ts
12688
12688
  var segmentCodec = codeLoader(async () => {
12689
- const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-WGP4FBXF.mjs')]);
12689
+ const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./segment-codec-leaf-BSDDR7DQ.mjs')]);
12690
12690
  code7.bindSegmentCodecHost(optionalCodeHost(), msgpack);
12691
12691
  return code7;
12692
12692
  }, "segment codec");
@@ -12694,7 +12694,7 @@ var loadSegmentCodec = segmentCodec.load;
12694
12694
 
12695
12695
  // src/query-suggestions/store-code.ts
12696
12696
  var suggestionStore = codeLoader(async () => {
12697
- const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./store-leaf-YDJVH73G.mjs')]);
12697
+ const [msgpack, code7] = await Promise.all([loadMessagePack(), import('./store-leaf-NCGETZYY.mjs')]);
12698
12698
  code7.bindSuggestionStoreHost(optionalCodeHost(), msgpack);
12699
12699
  return code7;
12700
12700
  }, "query suggestions store");
@@ -12775,7 +12775,7 @@ var storageCode = codeLoader(async () => {
12775
12775
  loadSegmentMerge(),
12776
12776
  loadSuggestionStore(),
12777
12777
  loadVectorCore(),
12778
- import('./storage-leaf-GRG44RQA.mjs')
12778
+ import('./storage-leaf-R5JQ2X2M.mjs')
12779
12779
  ]);
12780
12780
  code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
12781
12781
  return code7;
@@ -13614,6 +13614,177 @@ function mergeGroupComponents(components, internalId, contribution) {
13614
13614
  });
13615
13615
  }
13616
13616
 
13617
+ // src/core/partition/top-k-heap.ts
13618
+ function candidateWorse(a, b) {
13619
+ if (a.score < b.score) return true;
13620
+ if (a.score > b.score) return false;
13621
+ return unorderedCandidateWorse(a, b);
13622
+ }
13623
+ function unorderedCandidateWorse(a, b) {
13624
+ return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
13625
+ }
13626
+ function buildMinHeap(heap) {
13627
+ for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
13628
+ siftDown(heap, index);
13629
+ }
13630
+ }
13631
+ function siftDown(heap, start) {
13632
+ const len = heap.length;
13633
+ let current = start;
13634
+ for (; ; ) {
13635
+ let worst = current;
13636
+ const left = 2 * current + 1;
13637
+ const right = 2 * current + 2;
13638
+ if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
13639
+ if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
13640
+ if (worst === current) break;
13641
+ const held = heap[current];
13642
+ heap[current] = heap[worst];
13643
+ heap[worst] = held;
13644
+ current = worst;
13645
+ }
13646
+ }
13647
+ function sortSelection(heap) {
13648
+ heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
13649
+ }
13650
+
13651
+ // src/core/partition/score-buffer.ts
13652
+ var MAX_GENERATION = 2147483647;
13653
+ function createScoreBuffer(capacity) {
13654
+ return {
13655
+ scores: new Float64Array(capacity),
13656
+ stamps: new Int32Array(capacity),
13657
+ touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
13658
+ touchedCount: 0,
13659
+ generation: 0
13660
+ };
13661
+ }
13662
+ function beginScoring(buffer, capacity) {
13663
+ if (buffer.scores.length < capacity) {
13664
+ buffer.scores = new Float64Array(capacity);
13665
+ buffer.stamps = new Int32Array(capacity);
13666
+ buffer.generation = 0;
13667
+ }
13668
+ if (buffer.generation >= MAX_GENERATION) {
13669
+ buffer.stamps.fill(0);
13670
+ buffer.generation = 0;
13671
+ }
13672
+ buffer.generation++;
13673
+ buffer.touchedCount = 0;
13674
+ }
13675
+ function appendTouched(buffer, internalId) {
13676
+ if (buffer.touchedCount === buffer.touched.length) {
13677
+ const grown4 = new Int32Array(buffer.touched.length * 2);
13678
+ grown4.set(buffer.touched);
13679
+ buffer.touched = grown4;
13680
+ }
13681
+ buffer.touched[buffer.touchedCount] = internalId;
13682
+ buffer.touchedCount++;
13683
+ }
13684
+ function addScore(buffer, internalId, termScore) {
13685
+ if (buffer.stamps[internalId] === buffer.generation) {
13686
+ buffer.scores[internalId] += termScore;
13687
+ return;
13688
+ }
13689
+ buffer.stamps[internalId] = buffer.generation;
13690
+ buffer.scores[internalId] = termScore;
13691
+ appendTouched(buffer, internalId);
13692
+ }
13693
+ function markCounted(buffer, internalId) {
13694
+ const countedStamp = -buffer.generation;
13695
+ const stamp = buffer.stamps[internalId];
13696
+ if (stamp === buffer.generation || stamp === countedStamp) return false;
13697
+ buffer.stamps[internalId] = countedStamp;
13698
+ return true;
13699
+ }
13700
+ function kthBestScore(buffer, selection, resolver) {
13701
+ const wanted = selection.length;
13702
+ const { touched, touchedCount, scores } = buffer;
13703
+ let size = 0;
13704
+ let unordered = 0;
13705
+ for (let index = 0; index < touchedCount; index++) {
13706
+ const internalId = touched[index];
13707
+ const score = scores[internalId];
13708
+ if (size === wanted && !(score > selection[0])) continue;
13709
+ if (!resolver.isLive(internalId)) continue;
13710
+ let at = 0;
13711
+ if (size < wanted) {
13712
+ if (Number.isNaN(score)) {
13713
+ unordered++;
13714
+ continue;
13715
+ }
13716
+ at = size++;
13717
+ while (at > 0) {
13718
+ const parent = at - 1 >> 1;
13719
+ if (selection[parent] <= score) break;
13720
+ selection[at] = selection[parent];
13721
+ at = parent;
13722
+ }
13723
+ } else {
13724
+ for (; ; ) {
13725
+ const left = 2 * at + 1;
13726
+ if (left >= size) break;
13727
+ const right = left + 1;
13728
+ const child = right < size && selection[right] < selection[left] ? right : left;
13729
+ if (selection[child] >= score) break;
13730
+ selection[at] = selection[child];
13731
+ at = child;
13732
+ }
13733
+ }
13734
+ selection[at] = score;
13735
+ }
13736
+ if (wanted === 0) return Number.NEGATIVE_INFINITY;
13737
+ if (size === wanted) return selection[0];
13738
+ return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
13739
+ }
13740
+ function hasScore(buffer, internalId) {
13741
+ return buffer.stamps[internalId] === buffer.generation;
13742
+ }
13743
+ function topKFromBuffer(buffer, k, resolver, components) {
13744
+ const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
13745
+ if (wanted <= 0) return [];
13746
+ const heap = [];
13747
+ const { touched, touchedCount, scores } = buffer;
13748
+ let full = false;
13749
+ let threshold = 0;
13750
+ for (let index = 0; index < touchedCount; index++) {
13751
+ const internalId = touched[index];
13752
+ const score = scores[internalId];
13753
+ if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
13754
+ const externalId = resolver.toExternal(internalId);
13755
+ if (externalId === void 0) continue;
13756
+ const candidate = { internalId, externalId, score };
13757
+ if (!full) {
13758
+ heap.push(candidate);
13759
+ if (heap.length === wanted) {
13760
+ buildMinHeap(heap);
13761
+ full = true;
13762
+ threshold = heap[0].score;
13763
+ }
13764
+ continue;
13765
+ }
13766
+ if (candidateWorse(heap[0], candidate)) {
13767
+ heap[0] = candidate;
13768
+ siftDown(heap, 0);
13769
+ threshold = heap[0].score;
13770
+ }
13771
+ }
13772
+ sortSelection(heap);
13773
+ const result = new Array(heap.length);
13774
+ for (let index = 0; index < heap.length; index++) {
13775
+ const entry = heap[index];
13776
+ const record2 = components?.get(entry.internalId);
13777
+ result[index] = {
13778
+ docId: entry.externalId,
13779
+ score: entry.score,
13780
+ termFrequencies: record2?.termFrequencies ?? EMPTY_COMPONENTS,
13781
+ fieldLengths: record2?.fieldLengths ?? EMPTY_COMPONENTS,
13782
+ idf: record2?.idf ?? EMPTY_COMPONENTS
13783
+ };
13784
+ }
13785
+ return result;
13786
+ }
13787
+
13617
13788
  // src/core/partition/group-scoring.ts
13618
13789
  function partialFieldMarks(fieldNames, partialFields) {
13619
13790
  const marks = new Uint8Array(fieldNames.length);
@@ -13667,72 +13838,98 @@ function groupPostingCount(matches) {
13667
13838
  for (const match of matches) total += match.postingList.length;
13668
13839
  return total;
13669
13840
  }
13670
- function computeGroupContributions(context, matches, collect3) {
13671
- const { fields, fieldNames, filterBitset, partialMarks } = context;
13841
+ function scoreMatchPostings(context, match, visit) {
13842
+ const { fields, filterBitset, partialMarks } = context;
13672
13843
  const scoresAreZero = context.totalDocs === 0;
13673
13844
  const onePair = fields.boundPairs.length === 2;
13845
+ const { docIds, termFrequencies, fieldNameIndices, deletedDocs, hasDeleted, count } = postingColumns(
13846
+ match.postingList
13847
+ );
13848
+ let runStart = 0;
13849
+ let runEnd = 0;
13850
+ for (let at = 0; at < count; at++) {
13851
+ const internalId = docIds[at];
13852
+ if (hasDeleted && deletedDocs.has(internalId)) continue;
13853
+ if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
13854
+ let pi = at;
13855
+ if (at < runEnd) {
13856
+ pi = fieldRun.entries[at - runStart];
13857
+ } else if (at + 2 < count && docIds[at + 2] === internalId) {
13858
+ pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
13859
+ runStart = at;
13860
+ runEnd = at + fieldRun.length;
13861
+ }
13862
+ const fieldIndex = fieldNameIndices[pi];
13863
+ if (fields.searchable[fieldIndex] === 0) continue;
13864
+ const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
13865
+ if (factor === 0) continue;
13866
+ const termFrequency = termFrequencies[pi];
13867
+ const fieldBoost = fields.boosts[fieldIndex];
13868
+ const avgLen = fields.averageLengths[fieldIndex];
13869
+ const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
13870
+ const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
13871
+ termFrequency,
13872
+ match.idf,
13873
+ actualFieldLength,
13874
+ avgLen,
13875
+ onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
13876
+ onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
13877
+ )) * fieldBoost * factor;
13878
+ visit(internalId, fieldIndex, termFrequency, actualFieldLength, termScore);
13879
+ }
13880
+ }
13881
+ var termScores = null;
13882
+ var bestScores = null;
13883
+ function addGroupScores(context, matches, target, only, coverage) {
13884
+ const best = bestGroupScores(context, matches, target.scores.length);
13885
+ for (let index = 0; index < best.touchedCount; index++) {
13886
+ const internalId = best.touched[index];
13887
+ if (only !== null && !bitsetHas(only, internalId)) continue;
13888
+ coverage?.mark(internalId);
13889
+ addScore(target, internalId, best.scores[internalId]);
13890
+ }
13891
+ }
13892
+ function bestGroupScores(context, matches, capacity) {
13893
+ termScores ??= createScoreBuffer(capacity);
13894
+ bestScores ??= createScoreBuffer(capacity);
13895
+ const perTerm = termScores;
13896
+ const best = bestScores;
13897
+ const addTermScore = (internalId, _fieldIndex, _termFrequency, _fieldLength, termScore) => addScore(perTerm, internalId, termScore);
13898
+ beginScoring(best, capacity);
13899
+ for (const match of matches) {
13900
+ beginScoring(perTerm, capacity);
13901
+ scoreMatchPostings(context, match, addTermScore);
13902
+ for (let index = 0; index < perTerm.touchedCount; index++) {
13903
+ const internalId = perTerm.touched[index];
13904
+ const score = perTerm.scores[internalId];
13905
+ if (!hasScore(best, internalId)) addScore(best, internalId, score);
13906
+ else if (compareScores(score, best.scores[internalId]) < 0) best.scores[internalId] = score;
13907
+ }
13908
+ }
13909
+ return best;
13910
+ }
13911
+ function computeGroupContributions(context, matches) {
13912
+ const { fieldNames } = context;
13674
13913
  const best = /* @__PURE__ */ new Map();
13675
13914
  for (const match of matches) {
13676
13915
  const perTerm = /* @__PURE__ */ new Map();
13677
- const { docIds, termFrequencies, fieldNameIndices, deletedDocs, hasDeleted, count } = postingColumns(
13678
- match.postingList
13679
- );
13680
- let runStart = 0;
13681
- let runEnd = 0;
13682
- for (let at = 0; at < count; at++) {
13683
- const internalId = docIds[at];
13684
- if (hasDeleted && deletedDocs.has(internalId)) continue;
13685
- if (filterBitset && !bitsetHas(filterBitset, internalId)) continue;
13686
- let pi = at;
13687
- if (at < runEnd) {
13688
- pi = fieldRun.entries[at - runStart];
13689
- } else if (at + 2 < count && docIds[at + 2] === internalId) {
13690
- pi = orderRunByFieldName(docIds, fieldNameIndices, fields.nameRanks, at, count)[0];
13691
- runStart = at;
13692
- runEnd = at + fieldRun.length;
13693
- }
13694
- const fieldIndex = fieldNameIndices[pi];
13695
- if (fields.searchable[fieldIndex] === 0) continue;
13696
- const factor = partialMarks[fieldIndex] === 1 ? match.partialFactor : match.factor;
13697
- if (factor === 0) continue;
13916
+ scoreMatchPostings(context, match, (internalId, fieldIndex, termFrequency, actualFieldLength, termScore) => {
13698
13917
  const fieldName = fieldNames[fieldIndex];
13699
- const termFrequency = termFrequencies[pi];
13700
- const fieldBoost = fields.boosts[fieldIndex];
13701
- const avgLen = fields.averageLengths[fieldIndex];
13702
- const actualFieldLength = fieldLengthOf(fields.lengthColumns, fieldIndex, internalId, avgLen);
13703
- const termScore = (scoresAreZero ? 0 : computeBM25WithIDF(
13704
- termFrequency,
13705
- match.idf,
13706
- actualFieldLength,
13707
- avgLen,
13708
- onePair ? fields.boundPairs[0] : fields.k1s[fieldIndex],
13709
- onePair ? fields.boundPairs[1] : fields.bs[fieldIndex]
13710
- )) * fieldBoost * factor;
13711
13918
  const existing = perTerm.get(internalId);
13712
13919
  if (existing) {
13713
13920
  existing.score += termScore;
13714
- if (collect3) {
13715
- existing.termFrequencies[`${fieldName}:${match.token}`] = termFrequency;
13716
- existing.fieldLengths[fieldName] = actualFieldLength;
13717
- }
13718
- } else if (collect3) {
13719
- perTerm.set(internalId, {
13720
- score: termScore,
13721
- token: match.token,
13722
- idf: match.idf,
13723
- termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
13724
- fieldLengths: { [fieldName]: actualFieldLength }
13725
- });
13726
- } else {
13727
- perTerm.set(internalId, {
13728
- score: termScore,
13729
- token: match.token,
13730
- idf: match.idf,
13731
- termFrequencies: EMPTY_COMPONENTS,
13732
- fieldLengths: EMPTY_COMPONENTS
13733
- });
13921
+ existing.termFrequencies[`${fieldName}:${match.token}`] = termFrequency;
13922
+ existing.fieldLengths[fieldName] = actualFieldLength;
13923
+ return;
13734
13924
  }
13735
- }
13925
+ perTerm.set(internalId, {
13926
+ score: termScore,
13927
+ token: match.token,
13928
+ idf: match.idf,
13929
+ termFrequencies: { [`${fieldName}:${match.token}`]: termFrequency },
13930
+ fieldLengths: { [fieldName]: actualFieldLength }
13931
+ });
13932
+ });
13736
13933
  for (const [internalId, contribution] of perTerm) {
13737
13934
  const current = best.get(internalId);
13738
13935
  if (!current || compareScores(contribution.score, current.score) < 0) {
@@ -14259,177 +14456,6 @@ function blockBoundsFor(list, columns2) {
14259
14456
  return built2;
14260
14457
  }
14261
14458
 
14262
- // src/core/partition/top-k-heap.ts
14263
- function candidateWorse(a, b) {
14264
- if (a.score < b.score) return true;
14265
- if (a.score > b.score) return false;
14266
- return unorderedCandidateWorse(a, b);
14267
- }
14268
- function unorderedCandidateWorse(a, b) {
14269
- return (compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId)) > 0;
14270
- }
14271
- function buildMinHeap(heap) {
14272
- for (let index = (heap.length >> 1) - 1; index >= 0; index--) {
14273
- siftDown(heap, index);
14274
- }
14275
- }
14276
- function siftDown(heap, start) {
14277
- const len = heap.length;
14278
- let current = start;
14279
- for (; ; ) {
14280
- let worst = current;
14281
- const left = 2 * current + 1;
14282
- const right = 2 * current + 2;
14283
- if (left < len && candidateWorse(heap[left], heap[worst])) worst = left;
14284
- if (right < len && candidateWorse(heap[right], heap[worst])) worst = right;
14285
- if (worst === current) break;
14286
- const held = heap[current];
14287
- heap[current] = heap[worst];
14288
- heap[worst] = held;
14289
- current = worst;
14290
- }
14291
- }
14292
- function sortSelection(heap) {
14293
- heap.sort((a, b) => compareScores(a.score, b.score) || compareCodePoints(a.externalId, b.externalId));
14294
- }
14295
-
14296
- // src/core/partition/score-buffer.ts
14297
- var MAX_GENERATION = 2147483647;
14298
- function createScoreBuffer(capacity) {
14299
- return {
14300
- scores: new Float64Array(capacity),
14301
- stamps: new Int32Array(capacity),
14302
- touched: new Int32Array(Math.max(1, Math.min(capacity, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY))),
14303
- touchedCount: 0,
14304
- generation: 0
14305
- };
14306
- }
14307
- function beginScoring(buffer, capacity) {
14308
- if (buffer.scores.length < capacity) {
14309
- buffer.scores = new Float64Array(capacity);
14310
- buffer.stamps = new Int32Array(capacity);
14311
- buffer.generation = 0;
14312
- }
14313
- if (buffer.generation >= MAX_GENERATION) {
14314
- buffer.stamps.fill(0);
14315
- buffer.generation = 0;
14316
- }
14317
- buffer.generation++;
14318
- buffer.touchedCount = 0;
14319
- }
14320
- function appendTouched(buffer, internalId) {
14321
- if (buffer.touchedCount === buffer.touched.length) {
14322
- const grown4 = new Int32Array(buffer.touched.length * 2);
14323
- grown4.set(buffer.touched);
14324
- buffer.touched = grown4;
14325
- }
14326
- buffer.touched[buffer.touchedCount] = internalId;
14327
- buffer.touchedCount++;
14328
- }
14329
- function addScore(buffer, internalId, termScore) {
14330
- if (buffer.stamps[internalId] === buffer.generation) {
14331
- buffer.scores[internalId] += termScore;
14332
- return;
14333
- }
14334
- buffer.stamps[internalId] = buffer.generation;
14335
- buffer.scores[internalId] = termScore;
14336
- appendTouched(buffer, internalId);
14337
- }
14338
- function markCounted(buffer, internalId) {
14339
- const countedStamp = -buffer.generation;
14340
- const stamp = buffer.stamps[internalId];
14341
- if (stamp === buffer.generation || stamp === countedStamp) return false;
14342
- buffer.stamps[internalId] = countedStamp;
14343
- return true;
14344
- }
14345
- function kthBestScore(buffer, selection, resolver) {
14346
- const wanted = selection.length;
14347
- const { touched, touchedCount, scores } = buffer;
14348
- let size = 0;
14349
- let unordered = 0;
14350
- for (let index = 0; index < touchedCount; index++) {
14351
- const internalId = touched[index];
14352
- const score = scores[internalId];
14353
- if (size === wanted && !(score > selection[0])) continue;
14354
- if (!resolver.isLive(internalId)) continue;
14355
- let at = 0;
14356
- if (size < wanted) {
14357
- if (Number.isNaN(score)) {
14358
- unordered++;
14359
- continue;
14360
- }
14361
- at = size++;
14362
- while (at > 0) {
14363
- const parent = at - 1 >> 1;
14364
- if (selection[parent] <= score) break;
14365
- selection[at] = selection[parent];
14366
- at = parent;
14367
- }
14368
- } else {
14369
- for (; ; ) {
14370
- const left = 2 * at + 1;
14371
- if (left >= size) break;
14372
- const right = left + 1;
14373
- const child = right < size && selection[right] < selection[left] ? right : left;
14374
- if (selection[child] >= score) break;
14375
- selection[at] = selection[child];
14376
- at = child;
14377
- }
14378
- }
14379
- selection[at] = score;
14380
- }
14381
- if (wanted === 0) return Number.NEGATIVE_INFINITY;
14382
- if (size === wanted) return selection[0];
14383
- return size + unordered >= wanted ? Number.NaN : Number.NEGATIVE_INFINITY;
14384
- }
14385
- function hasScore(buffer, internalId) {
14386
- return buffer.stamps[internalId] === buffer.generation;
14387
- }
14388
- function topKFromBuffer(buffer, k, resolver, components) {
14389
- const wanted = Number.isFinite(k) ? Math.max(0, Math.floor(k)) : 0;
14390
- if (wanted <= 0) return [];
14391
- const heap = [];
14392
- const { touched, touchedCount, scores } = buffer;
14393
- let full = false;
14394
- let threshold = 0;
14395
- for (let index = 0; index < touchedCount; index++) {
14396
- const internalId = touched[index];
14397
- const score = scores[internalId];
14398
- if (full && (score < threshold || Number.isNaN(score) && !Number.isNaN(threshold))) continue;
14399
- const externalId = resolver.toExternal(internalId);
14400
- if (externalId === void 0) continue;
14401
- const candidate = { internalId, externalId, score };
14402
- if (!full) {
14403
- heap.push(candidate);
14404
- if (heap.length === wanted) {
14405
- buildMinHeap(heap);
14406
- full = true;
14407
- threshold = heap[0].score;
14408
- }
14409
- continue;
14410
- }
14411
- if (candidateWorse(heap[0], candidate)) {
14412
- heap[0] = candidate;
14413
- siftDown(heap, 0);
14414
- threshold = heap[0].score;
14415
- }
14416
- }
14417
- sortSelection(heap);
14418
- const result = new Array(heap.length);
14419
- for (let index = 0; index < heap.length; index++) {
14420
- const entry = heap[index];
14421
- const record2 = components?.get(entry.internalId);
14422
- result[index] = {
14423
- docId: entry.externalId,
14424
- score: entry.score,
14425
- termFrequencies: record2?.termFrequencies ?? EMPTY_COMPONENTS,
14426
- fieldLengths: record2?.fieldLengths ?? EMPTY_COMPONENTS,
14427
- idf: record2?.idf ?? EMPTY_COMPONENTS
14428
- };
14429
- }
14430
- return result;
14431
- }
14432
-
14433
14459
  // src/core/partition/multi-term-topk.ts
14434
14460
  function prunableMultiTermLists(params, index) {
14435
14461
  if (params.queryTokens.length < 2) return null;
@@ -15072,10 +15098,14 @@ function searchFulltext(state, params) {
15072
15098
  }
15073
15099
  function scoreGroup(group, only) {
15074
15100
  if (group === null) return;
15075
- for (const [internalId, contribution] of computeGroupContributions(groupContext, group, collectComponents)) {
15076
- if (only !== null && !bitsetHas(only, internalId)) continue;
15077
- mergeGroupContribution(internalId, contribution);
15101
+ if (components !== null) {
15102
+ for (const [internalId, contribution] of computeGroupContributions(groupContext, group)) {
15103
+ if (only !== null && !bitsetHas(only, internalId)) continue;
15104
+ mergeGroupContribution(internalId, contribution);
15105
+ }
15106
+ return;
15078
15107
  }
15108
+ addGroupScores(groupContext, group, scoreBuffer, only, coverage);
15079
15109
  }
15080
15110
  const prunableList = phrases === void 0 ? prunableSingleTermList(params, state.invertedIdx, fieldNames) : null;
15081
15111
  if (prunableList !== null && maxResults !== void 0) {
@@ -19092,11 +19122,13 @@ function assembleFrozenSegment(segmentId, source2, documentSource, sharedSnapsho
19092
19122
  isTombstoned: (ordinal) => tombstones.has(ordinal),
19093
19123
  settleRemovals: counts.settleRemovals
19094
19124
  });
19095
- const textDocuments = {
19096
- count: documentSource.count,
19097
- textFields: source2.fieldLengthNames,
19098
- documentAt: (ordinal) => documentSource.readAt(ordinal)
19125
+ const textFieldsOnly = {
19126
+ kind: "fields",
19127
+ include: source2.fieldLengthNames.map((fieldPath) => fieldPath.split(".")),
19128
+ exclude: []
19099
19129
  };
19130
+ const textAt2 = (ordinal) => documentSource.readAt(ordinal, textFieldsOnly);
19131
+ const textDocuments = { count: documentSource.count, textFields: source2.fieldLengthNames, documentAt: textAt2 };
19100
19132
  const loadSurfaceForms = survivingSurfaceForms === void 0 ? source2.readSurfaceForms : () => survivingSurfaceForms;
19101
19133
  const surfaces = createFrozenSurfaceSlot(
19102
19134
  loadSurfaceForms,
@@ -19168,7 +19200,7 @@ function assembleFrozenSegment(segmentId, source2, documentSource, sharedSnapsho
19168
19200
  source2.fieldNames,
19169
19201
  source2.fieldLengthNames,
19170
19202
  ordinal,
19171
- documentSource.readAt(ordinal),
19203
+ textAt2(ordinal),
19172
19204
  analysis,
19173
19205
  surfaces,
19174
19206
  partialWords
@@ -20105,11 +20137,12 @@ function bindSegmentCodecHost(_host, _msgpack) {
20105
20137
  // src/serialization/msgpack-without-fields.ts
20106
20138
  var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
20107
20139
  var keyDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
20140
+ var walkedHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
20108
20141
  function endOfValue(view, start) {
20109
20142
  let offset = start;
20110
20143
  let pending = 1;
20111
20144
  while (pending > 0) {
20112
- const header = headerAt(view, offset);
20145
+ const header = headerAt(view, offset, walkedHeader);
20113
20146
  if (header === null) return null;
20114
20147
  offset += header.headerBytes + header.bodyBytes;
20115
20148
  if (offset > view.byteLength) return null;
@@ -20178,6 +20211,8 @@ function decodeMapWithoutFields(bytes, skippedFields) {
20178
20211
  var encoder6 = new TextEncoder();
20179
20212
  var PROTO_KEY_BYTES = encoder6.encode("__proto__");
20180
20213
  var MISSING = { found: false, value: void 0 };
20214
+ var mapHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
20215
+ var keyHeader = { headerBytes: 0, bodyBytes: 0, children: 0 };
20181
20216
  var pathDecoder = null;
20182
20217
  function encodePathSegments(segments2) {
20183
20218
  if (segments2.length === 0) return null;
@@ -20204,14 +20239,12 @@ function sameBytes(bytes, start, end, target) {
20204
20239
  }
20205
20240
  return true;
20206
20241
  }
20207
- function keyRangeAt(view, offset) {
20208
- if (!isStringTag(view.getUint8(offset))) return null;
20209
- const header = headerAt(view, offset);
20210
- if (header === null) return null;
20211
- const start = offset + header.headerBytes;
20212
- return { start, end: start + header.bodyBytes };
20242
+ function keyEndAt(view, offset) {
20243
+ if (!isStringTag(view.getUint8(offset))) return -1;
20244
+ if (headerAt(view, offset, keyHeader) === null) return -1;
20245
+ return offset + keyHeader.headerBytes + keyHeader.bodyBytes;
20213
20246
  }
20214
- function readEncodedPath(bytes, segments2, arrays) {
20247
+ function readEncodedPath(bytes, segments2, arrays, foundRead) {
20215
20248
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
20216
20249
  let start = 0;
20217
20250
  let end = bytes.length;
@@ -20223,20 +20256,21 @@ function readEncodedPath(bytes, segments2, arrays) {
20223
20256
  if (isArrayTag(tag2)) return arrays === "missing" ? MISSING : null;
20224
20257
  return isScalarTag(tag2) ? MISSING : null;
20225
20258
  }
20226
- const header = headerAt(view, start);
20227
- if (header === null) return null;
20228
- let offset = start + header.headerBytes;
20259
+ if (headerAt(view, start, mapHeader) === null) return null;
20260
+ const pairs = mapHeader.children / 2;
20261
+ let offset = start + mapHeader.headerBytes;
20229
20262
  let valueStart = -1;
20230
20263
  let valueEnd = -1;
20231
- for (let pair = 0; pair < header.children / 2; pair++) {
20264
+ for (let pair = 0; pair < pairs; pair++) {
20232
20265
  if (offset >= end) return null;
20233
- const key = keyRangeAt(view, offset);
20234
- if (key === null || key.end > end) return null;
20235
- if (sameBytes(bytes, key.start, key.end, PROTO_KEY_BYTES)) return null;
20236
- const next = endOfValue(view, key.end);
20266
+ const keyEnd = keyEndAt(view, offset);
20267
+ if (keyEnd < 0 || keyEnd > end) return null;
20268
+ const keyStart = offset + keyHeader.headerBytes;
20269
+ if (sameBytes(bytes, keyStart, keyEnd, PROTO_KEY_BYTES)) return null;
20270
+ const next = endOfValue(view, keyEnd);
20237
20271
  if (next === null || next > end) return null;
20238
- if (sameBytes(bytes, key.start, key.end, segments2[depth])) {
20239
- valueStart = key.end;
20272
+ if (sameBytes(bytes, keyStart, keyEnd, segments2[depth])) {
20273
+ valueStart = keyEnd;
20240
20274
  valueEnd = next;
20241
20275
  }
20242
20276
  offset = next;
@@ -20248,7 +20282,8 @@ function readEncodedPath(bytes, segments2, arrays) {
20248
20282
  }
20249
20283
  try {
20250
20284
  pathDecoder ??= new Decoder();
20251
- return { found: true, value: pathDecoder.decode(bytes.subarray(start, end)) };
20285
+ foundRead.value = pathDecoder.decode(bytes.subarray(start, end));
20286
+ return foundRead;
20252
20287
  } catch {
20253
20288
  return null;
20254
20289
  }
@@ -20344,20 +20379,35 @@ function wrapEncodedDocumentTable(data) {
20344
20379
  }
20345
20380
  function createEncodedDocumentSource(count, byteLength, bytesAt, discardedFields) {
20346
20381
  const discarded = (discardedFields ?? []).map((fieldPath) => fieldPath.split("."));
20347
- const touchesDiscarded = (path) => discarded.some((discardedPath) => sharesPrefix(discardedPath, path));
20382
+ const touchesDiscarded = (path) => {
20383
+ for (const discardedPath of discarded) {
20384
+ if (sharesPrefix(discardedPath, path)) return true;
20385
+ }
20386
+ return false;
20387
+ };
20348
20388
  const docAt = (ordinal) => documentWithOwnBuffers(decodeStoredDocument(bytesAt(ordinal), discardedFields));
20349
- function projectedPathAt(ordinal, path) {
20389
+ function projectedPathAt(ordinal, path, result) {
20350
20390
  const segments2 = encodedProjectionPathOf(path);
20351
20391
  if (segments2 === null) return { found: false, value: void 0 };
20352
- const read = touchesDiscarded(path) ? null : readEncodedPath(bytesAt(ordinal), segments2, "missing");
20392
+ const read = touchesDiscarded(path) ? null : readEncodedPath(bytesAt(ordinal), segments2, "missing", result);
20353
20393
  if (read === null) return readProjectedPath(docAt(ordinal), path);
20354
- return read.found ? { found: true, value: valueWithOwnBuffers(read.value) } : read;
20394
+ if (!read.found) return read;
20395
+ read.value = valueWithOwnBuffers(read.value);
20396
+ return read;
20397
+ }
20398
+ function projectedAt(ordinal, projection) {
20399
+ if (projection === void 0 || projection.kind === "full") return docAt(ordinal);
20400
+ if (projection.kind === "none") return {};
20401
+ if (projection.include === null) return cloneProjected(docAt(ordinal), projection);
20402
+ const result = { found: true, value: void 0 };
20403
+ return projectIncludedPaths(projection.include, projection.exclude, (path) => projectedPathAt(ordinal, path, result));
20355
20404
  }
20356
20405
  return {
20357
20406
  count,
20358
20407
  byteLength,
20359
20408
  docAt,
20360
- readAt(ordinal) {
20409
+ readAt(ordinal, fields) {
20410
+ if (fields !== void 0) return projectedAt(ordinal, fields);
20361
20411
  return decodeStoredDocument(bytesAt(ordinal), discardedFields);
20362
20412
  },
20363
20413
  fieldReader(fieldPath) {
@@ -20366,16 +20416,15 @@ function createEncodedDocumentSource(count, byteLength, bytesAt, discardedFields
20366
20416
  if (segments2 === null) return () => void 0;
20367
20417
  const decodesDocument = touchesDiscarded(path);
20368
20418
  return (ordinal) => {
20369
- const read = decodesDocument ? null : readEncodedPath(bytesAt(ordinal), segments2, "decode-document");
20419
+ const read = decodesDocument ? null : readEncodedPath(bytesAt(ordinal), segments2, "decode-document", { found: true, value: void 0 });
20370
20420
  if (read !== null) return valueWithOwnBuffers(read.value);
20371
20421
  return getNestedValue(docAt(ordinal), fieldPath);
20372
20422
  };
20373
20423
  },
20374
- projectedAt(ordinal, projection) {
20375
- if (projection === void 0 || projection.kind === "full") return docAt(ordinal);
20376
- if (projection.kind === "none") return {};
20377
- if (projection.include === null) return cloneProjected(docAt(ordinal), projection);
20378
- return projectIncludedPaths(projection.include, projection.exclude, (path) => projectedPathAt(ordinal, path));
20424
+ projectedAt,
20425
+ copyForRollbackAt(ordinal) {
20426
+ const bytes = bytesAt(ordinal).slice();
20427
+ return () => documentWithOwnBuffers(decodeStoredDocument(bytes, discardedFields));
20379
20428
  }
20380
20429
  };
20381
20430
  }
@@ -21549,7 +21598,7 @@ function hasLanguage(name) {
21549
21598
 
21550
21599
  // src/narsil/restore-queue-code.ts
21551
21600
  var restoreQueue = codeLoader(async () => {
21552
- const [suggestionStore2, code7] = await Promise.all([loadSuggestionStore(), import('./restore-queue-W7U2X6V3.mjs')]);
21601
+ const [suggestionStore2, code7] = await Promise.all([loadSuggestionStore(), import('./restore-queue-Q76Q4S35.mjs')]);
21553
21602
  code7.bindRestoreQueueHost(optionalCodeHost(), suggestionStore2);
21554
21603
  return code7;
21555
21604
  }, "restore");
@@ -22103,6 +22152,32 @@ function createSharedFrozenSegment(snapshot, survivingSurfaceForms) {
22103
22152
  );
22104
22153
  }
22105
22154
 
22155
+ // src/partitioning/manager/nested-values.ts
22156
+ function setNestedValue(obj, path, value) {
22157
+ if (!path.includes(".")) {
22158
+ obj[path] = value;
22159
+ return;
22160
+ }
22161
+ const segments2 = path.split(".");
22162
+ let current = obj;
22163
+ for (let i = 0; i < segments2.length - 1; i++) {
22164
+ let next = current[segments2[i]];
22165
+ if (next === null || next === void 0 || typeof next !== "object") {
22166
+ next = {};
22167
+ current[segments2[i]] = next;
22168
+ }
22169
+ current = next;
22170
+ }
22171
+ current[segments2[segments2.length - 1]] = value;
22172
+ }
22173
+ function copyVectorsInto(document, docId, vectorIndexes, projection) {
22174
+ for (const [fieldPath, vectorIndex] of vectorIndexes) {
22175
+ if (projection !== void 0 && !projectionKeepsField(projection, fieldPath)) continue;
22176
+ const vector = vectorIndex.getVector(docId);
22177
+ if (vector) setNestedValue(document, fieldPath, vector);
22178
+ }
22179
+ }
22180
+
22106
22181
  // src/engine/array-positions.ts
22107
22182
  function holdsStringArrayField(schema) {
22108
22183
  return schemaFieldsOf(schema).some((field) => field.base === "string[]");
@@ -22126,7 +22201,7 @@ var loadEmbedCode = embedCode.load;
22126
22201
 
22127
22202
  // src/engine/optional-writes-code.ts
22128
22203
  var optionalWrites = codeLoader(async () => {
22129
- const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-2OK4TOLY.mjs')]);
22204
+ const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-CSULLISE.mjs')]);
22130
22205
  code7.bindOptionalWritesHost(optionalCodeHost(), segmentCodec2);
22131
22206
  return code7;
22132
22207
  }, "write");
@@ -23003,7 +23078,7 @@ async function rollbackRemovedDocument(ctx, indexName, docId, restoreDoc, origin
23003
23078
  await manager.publication.write(
23004
23079
  () => changeIndexOutsideExternalWaits(async () => {
23005
23080
  if (manager.has(docId)) return;
23006
- const previous = prepareDocumentVectors(restoreDoc, ctx.requireIndex(indexName).vectorFieldPaths);
23081
+ const previous = prepareDocumentVectors(restoreDoc(), ctx.requireIndex(indexName).vectorFieldPaths);
23007
23082
  manager.insert(docId, previous.partitionDoc, {
23008
23083
  preparedText: { after: preparedText?.before }
23009
23084
  });
@@ -23700,6 +23775,36 @@ async function insertDocumentBatch(ctx, indexName, documents2, options, hold) {
23700
23775
  return { succeeded: inserts.succeeded, failed };
23701
23776
  }
23702
23777
 
23778
+ // src/engine/mutations/rollback-copy.ts
23779
+ function frozenRollbackCopy(manager, docId) {
23780
+ const partitionId = manager.partitionIdOf(docId);
23781
+ if (partitionId === void 0) return void 0;
23782
+ const partition = manager.getPartition(partitionId);
23783
+ if (!isCompositePartition(partition)) return void 0;
23784
+ for (const segment of partition.frozenSegments()) {
23785
+ const ordinal = segment.docStore.getInternalId(docId);
23786
+ if (ordinal !== void 0) return segment.documentSource.copyForRollbackAt?.(ordinal);
23787
+ }
23788
+ return void 0;
23789
+ }
23790
+ function rollbackCopyOf(manager, docId) {
23791
+ const frozenCopy = frozenRollbackCopy(manager, docId);
23792
+ if (frozenCopy === void 0) {
23793
+ const document = manager.get(docId);
23794
+ return document === void 0 ? void 0 : () => document;
23795
+ }
23796
+ const vectors = [];
23797
+ for (const [fieldPath, vectorIndex] of manager.getVectorIndexes()) {
23798
+ const vector = vectorIndex.getVector(docId);
23799
+ if (vector) vectors.push([fieldPath, vector]);
23800
+ }
23801
+ return () => {
23802
+ const document = frozenCopy();
23803
+ for (const [fieldPath, vector] of vectors) setNestedValue(document, fieldPath, vector);
23804
+ return document;
23805
+ };
23806
+ }
23807
+
23703
23808
  // src/engine/mutations/remove.ts
23704
23809
  function asRemoveError(ctx, err) {
23705
23810
  return batchFailureOf(ctx, err, ErrorCodes.DOC_NOT_FOUND);
@@ -23738,7 +23843,7 @@ function applyOfRemoval(ctx, indexName, prepared) {
23738
23843
  prepared.buffered = true;
23739
23844
  return queued;
23740
23845
  }
23741
- prepared.restoreDoc = ctx.durability ? manager.get(docId) : void 0;
23846
+ prepared.restoreDoc = ctx.durability ? rollbackCopyOf(manager, docId) : void 0;
23742
23847
  if (ctx.durability !== null) prepared.releaseVectorHolds = holdVectorsForRollback(manager.getVectorIndexes(), docId);
23743
23848
  manager.remove(docId, void 0, {
23744
23849
  onRemovedSpellings: (spellings) => {
@@ -25789,7 +25894,7 @@ var workerCopies = codeLoader(async () => {
25789
25894
  const [segmentCodec2, segmentMerge2, code7] = await Promise.all([
25790
25895
  loadSegmentCodec(),
25791
25896
  loadSegmentMerge(),
25792
- import('./worker-copies-IP4L7KEW.mjs')
25897
+ import('./worker-copies-NZSBQZKG.mjs')
25793
25898
  ]);
25794
25899
  code7.bindWorkerCopiesHost(optionalCodeHost(), segmentCodec2, segmentMerge2);
25795
25900
  return code7;
@@ -28876,32 +28981,6 @@ function partitionStoredFields(partition, docId, fields) {
28876
28981
  return void 0;
28877
28982
  }
28878
28983
 
28879
- // src/partitioning/manager/nested-values.ts
28880
- function setNestedValue(obj, path, value) {
28881
- if (!path.includes(".")) {
28882
- obj[path] = value;
28883
- return;
28884
- }
28885
- const segments2 = path.split(".");
28886
- let current = obj;
28887
- for (let i = 0; i < segments2.length - 1; i++) {
28888
- let next = current[segments2[i]];
28889
- if (next === null || next === void 0 || typeof next !== "object") {
28890
- next = {};
28891
- current[segments2[i]] = next;
28892
- }
28893
- current = next;
28894
- }
28895
- current[segments2[segments2.length - 1]] = value;
28896
- }
28897
- function copyVectorsInto(document, docId, vectorIndexes, projection) {
28898
- for (const [fieldPath, vectorIndex] of vectorIndexes) {
28899
- if (projection !== void 0 && !projectionKeepsField(projection, fieldPath)) continue;
28900
- const vector = vectorIndex.getVector(docId);
28901
- if (vector) setNestedValue(document, fieldPath, vector);
28902
- }
28903
- }
28904
-
28905
28984
  // src/partitioning/manager/state-pins.ts
28906
28985
  function documentFieldValues(ref, fieldPaths) {
28907
28986
  return fieldPaths.map((fieldPath) => getNestedValue(ref, fieldPath));
@@ -30293,7 +30372,7 @@ var suggestionsCode = codeLoader(async () => {
30293
30372
  const [msgpack, suggestionStore2, code7] = await Promise.all([
30294
30373
  loadMessagePack(),
30295
30374
  loadSuggestionStore(),
30296
- import('./suggestions-leaf-5UFJV7SC.mjs')
30375
+ import('./suggestions-leaf-TX3GTD6S.mjs')
30297
30376
  ]);
30298
30377
  code7.bindSuggestionsHost(optionalCodeHost(), msgpack, suggestionStore2);
30299
30378
  return code7;
@@ -31405,6 +31484,7 @@ function writesHostPart() {
31405
31484
  requireDocumentWithinSizeLimit,
31406
31485
  requireMatchingDocId,
31407
31486
  requireSurfaceFormsForPartialFields,
31487
+ setNestedValue,
31408
31488
  storedBM25Params,
31409
31489
  turnsAreBudgeted,
31410
31490
  updateDocumentVectors,
@@ -31454,7 +31534,7 @@ var segmentMerge = codeLoader(async () => {
31454
31534
  const [msgpack, codec, code7] = await Promise.all([
31455
31535
  loadMessagePack(),
31456
31536
  loadSegmentCodec(),
31457
- import('./segment-merge-leaf-FYWJQSPL.mjs')
31537
+ import('./segment-merge-leaf-6TT66HC5.mjs')
31458
31538
  ]);
31459
31539
  code7.bindSegmentMergeHost(optionalCodeHost(), msgpack, codec);
31460
31540
  return code7;