@delali/narsil 0.1.10 → 0.1.12

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.
@@ -1,4 +1,4 @@
1
- import { getNestedValue, getLanguage, extractVectorFieldsFromSchema, createDirectExecutor, createPartitionRouter, createPartitionManager, createVectorIndex, validateSchema, deserializePayloadV2, tokenize, fanOutQuery, validateRequiredFields, validateVectorPromotion, createPartitionIndex, flattenSchema, fnv1a, detectRuntime, isNodeMainThread, spawnNodeWorker, kWayMerge } from './chunk-Q4OVNESD.mjs';
1
+ import { getNestedValue, getLanguage, extractVectorFieldsFromSchema, createDirectExecutor, createPartitionRouter, createPartitionManager, createVectorIndex, validateSchema, deserializePayloadV2, deserializePayloadV1, tokenize, fanOutQuery, validateRequiredFields, validateVectorPromotion, createPartitionIndex, flattenSchema, fnv1a, detectRuntime, serializeMetadata, isNodeMainThread, spawnNodeWorker, deserializeMetadata, kWayMerge } from './chunk-HMO6OMZ3.mjs';
2
2
  import { crc32, crc32Init, crc32Update, crc32Final } from './chunk-KMMJMDUA.mjs';
3
3
  import { ErrorCodes, NarsilError } from './chunk-ALB35PRQ.mjs';
4
4
  import { generateId, createRequestId, isValidWorkerResponse } from './chunk-HRABJLPB.mjs';
@@ -49,9 +49,15 @@ function createRebalancer() {
49
49
  });
50
50
  const newPartitions = [];
51
51
  for (let i = 0; i < newPartitionCount; i++) {
52
- newPartitions.push(createPartitionIndex(i));
52
+ newPartitions.push(createPartitionIndex(i, manager.config.trackPositions ?? true));
53
53
  }
54
54
  let documentsProcessed = 0;
55
+ const insertOptions = {
56
+ validate: false,
57
+ stopWordOverride: manager.config.stopWords,
58
+ customTokenizer: manager.config.tokenizer,
59
+ collectSurfaces: manager.config.surfaceForms === true
60
+ };
55
61
  for (let chunkStart = 0; chunkStart < collectedDocs.length; chunkStart += CHUNK_SIZE) {
56
62
  const chunkEnd = Math.min(chunkStart + CHUNK_SIZE, collectedDocs.length);
57
63
  for (let i = chunkStart; i < chunkEnd; i++) {
@@ -61,7 +67,7 @@ function createRebalancer() {
61
67
  if (targetPartition.has(docId)) {
62
68
  continue;
63
69
  }
64
- targetPartition.insert(docId, document, manager.schema, manager.language, { validate: false });
70
+ targetPartition.insert(docId, document, manager.schema, manager.language, insertOptions);
65
71
  documentsProcessed++;
66
72
  }
67
73
  onProgress?.({
@@ -748,141 +754,6 @@ function readHeader(data) {
748
754
  reserved
749
755
  };
750
756
  }
751
- var VALID_HNSW_METRICS = /* @__PURE__ */ new Set(["cosine", "dotProduct", "euclidean"]);
752
- function validateHnswMetric(value) {
753
- if (value === void 0 || value === null) return void 0;
754
- if (typeof value === "string" && VALID_HNSW_METRICS.has(value)) {
755
- return value;
756
- }
757
- return void 0;
758
- }
759
- function wireToPartition(raw) {
760
- const documents = {};
761
- for (const [docId, doc] of Object.entries(raw.documents ?? {})) {
762
- documents[docId] = {
763
- fields: doc.fields,
764
- fieldLengths: doc.field_lengths ?? {}
765
- };
766
- }
767
- const invertedIndex = {};
768
- for (const [token, list] of Object.entries(raw.inverted_index ?? {})) {
769
- invertedIndex[token] = {
770
- docFrequency: list.doc_freq,
771
- postings: (list.postings ?? []).map((p) => ({
772
- docId: p.doc_id,
773
- termFrequency: p.term_freq,
774
- field: p.field,
775
- positions: p.positions ?? []
776
- }))
777
- };
778
- }
779
- const numeric = {};
780
- for (const [field, entries] of Object.entries(raw.field_indexes?.numeric ?? {})) {
781
- numeric[field] = entries.map((e) => ({ value: e.value, docId: e.doc_id }));
782
- }
783
- const boolean = {};
784
- for (const [field, idx] of Object.entries(raw.field_indexes?.boolean ?? {})) {
785
- boolean[field] = { trueDocs: idx.true_docs ?? [], falseDocs: idx.false_docs ?? [] };
786
- }
787
- const geopoint = {};
788
- for (const [field, entries] of Object.entries(raw.field_indexes?.geopoint ?? {})) {
789
- geopoint[field] = entries.map((e) => ({ lat: e.lat, lon: e.lon, docId: e.doc_id }));
790
- }
791
- const vectorData = {};
792
- for (const [field, data] of Object.entries(raw.vector_data ?? {})) {
793
- vectorData[field] = {
794
- dimension: data.dimension,
795
- vectors: (data.vectors ?? []).map((v) => ({ docId: v.doc_id, vector: v.vector })),
796
- hnswGraph: data.hnsw_graph ? {
797
- entryPoint: data.hnsw_graph.entry_point,
798
- maxLayer: data.hnsw_graph.max_layer,
799
- m: data.hnsw_graph.m,
800
- efConstruction: data.hnsw_graph.ef_construction,
801
- metric: validateHnswMetric(data.hnsw_graph.metric),
802
- nodes: data.hnsw_graph.nodes
803
- } : null,
804
- sq8: data.sq8 ? {
805
- alpha: data.sq8.alpha,
806
- offset: data.sq8.offset,
807
- quantizedVectors: data.sq8.quantized_vectors,
808
- vectorSums: data.sq8.vector_sums,
809
- vectorSumSqs: data.sq8.vector_sum_sqs
810
- } : null
811
- };
812
- }
813
- return {
814
- indexName: raw.index_name,
815
- partitionId: raw.partition_id,
816
- totalPartitions: raw.total_partitions,
817
- language: raw.language ?? "english",
818
- schema: raw.schema ?? {},
819
- docCount: raw.doc_count ?? 0,
820
- avgDocLength: raw.avg_doc_length ?? 0,
821
- documents,
822
- invertedIndex,
823
- fieldIndexes: {
824
- numeric,
825
- boolean,
826
- enum: raw.field_indexes?.enum ?? {},
827
- geopoint
828
- },
829
- vectorData,
830
- statistics: {
831
- totalDocuments: raw.statistics?.total_documents ?? 0,
832
- totalFieldLengths: raw.statistics?.total_field_lengths ?? {},
833
- averageFieldLengths: raw.statistics?.average_field_lengths ?? {},
834
- docFrequencies: raw.statistics?.doc_frequencies ?? {}
835
- }
836
- };
837
- }
838
- function deserializePayloadV1(data) {
839
- const raw = decode(data);
840
- return wireToPartition(raw);
841
- }
842
- function metadataToWire(meta) {
843
- const wire = {
844
- index_name: meta.indexName,
845
- schema: meta.schema,
846
- language: meta.language,
847
- partition_count: meta.partitionCount,
848
- bm25_params: meta.bm25Params,
849
- created_at: meta.createdAt,
850
- engine_version: meta.engineVersion
851
- };
852
- if (meta.vectorFields) {
853
- wire.vector_fields = meta.vectorFields;
854
- }
855
- if (meta.embedding) {
856
- wire.embedding = meta.embedding.adapter !== void 0 ? { adapter: meta.embedding.adapter, fields: meta.embedding.fields } : { fields: meta.embedding.fields };
857
- }
858
- return wire;
859
- }
860
- function wireToMetadata(raw) {
861
- const meta = {
862
- indexName: raw.index_name,
863
- schema: raw.schema ?? {},
864
- language: raw.language ?? "english",
865
- partitionCount: raw.partition_count ?? 1,
866
- bm25Params: raw.bm25_params ?? { k1: 1.2, b: 0.75 },
867
- createdAt: raw.created_at ?? 0,
868
- engineVersion: raw.engine_version ?? "0.0.0"
869
- };
870
- if (raw.vector_fields) {
871
- meta.vectorFields = raw.vector_fields;
872
- }
873
- if (raw.embedding && typeof raw.embedding === "object" && typeof raw.embedding.fields === "object") {
874
- meta.embedding = typeof raw.embedding.adapter === "string" ? { adapter: raw.embedding.adapter, fields: raw.embedding.fields } : { fields: raw.embedding.fields };
875
- }
876
- return meta;
877
- }
878
- function serializeMetadata(meta) {
879
- const wire = metadataToWire(meta);
880
- return encode(wire);
881
- }
882
- function deserializeMetadata(data) {
883
- const raw = decode(data);
884
- return wireToMetadata(raw);
885
- }
886
757
 
887
758
  // src/serialization/envelope.ts
888
759
  var CURRENT_ENVELOPE_VERSION = 1;
@@ -1907,6 +1778,7 @@ function mergeTimeOrderedSegments(ordered, fallback) {
1907
1778
  collectDocuments(merged, part, winner, segIndex);
1908
1779
  collectInvertedIndex(merged, part, winner, segIndex);
1909
1780
  collectFieldIndexes(merged, part, winner, segIndex);
1781
+ collectSurfaceForms(merged, part);
1910
1782
  }
1911
1783
  recomputeStatistics(merged);
1912
1784
  validateMergedPartition(merged);
@@ -2034,6 +1906,26 @@ function collectFieldIndexes(merged, part, winner, segIndex) {
2034
1906
  }
2035
1907
  }
2036
1908
  }
1909
+ function collectSurfaceForms(merged, part) {
1910
+ if (!part.surfaceForms) return;
1911
+ let target = merged.surfaceForms;
1912
+ if (!target) {
1913
+ target = /* @__PURE__ */ Object.create(null);
1914
+ merged.surfaceForms = target;
1915
+ }
1916
+ for (const [surface, value] of Object.entries(part.surfaceForms)) {
1917
+ const count = typeof value === "number" ? value : value[0];
1918
+ const token = typeof value === "number" ? surface : value[1];
1919
+ const existing = target[surface];
1920
+ if (existing === void 0) {
1921
+ target[surface] = value;
1922
+ continue;
1923
+ }
1924
+ const existingCount = typeof existing === "number" ? existing : existing[0];
1925
+ const total = existingCount + count;
1926
+ target[surface] = token === surface ? total : [total, token];
1927
+ }
1928
+ }
2037
1929
  function recomputeStatistics(merged) {
2038
1930
  const totalFieldLengths = /* @__PURE__ */ Object.create(null);
2039
1931
  let totalDocuments = 0;
@@ -2244,6 +2136,9 @@ function reconstructSchemaFromMetadata(metadata) {
2244
2136
  if (metadata.embedding) {
2245
2137
  config.embedding = metadata.embedding.adapter !== void 0 ? { adapter: metadata.embedding.adapter, fields: metadata.embedding.fields } : { fields: metadata.embedding.fields };
2246
2138
  }
2139
+ if (metadata.surfaceForms === true) {
2140
+ config.surfaceForms = true;
2141
+ }
2247
2142
  return config;
2248
2143
  }
2249
2144
 
@@ -3830,6 +3725,9 @@ function buildMetadata(indexName, hooks) {
3830
3725
  if (config.embedding) {
3831
3726
  metadata.embedding = config.embedding;
3832
3727
  }
3728
+ if (config.surfaceForms) {
3729
+ metadata.surfaceForms = true;
3730
+ }
3833
3731
  return metadata;
3834
3732
  }
3835
3733
  function createDurabilityIntegration(tier, hooks) {
@@ -4349,7 +4247,8 @@ function createDurabilityFromConfig(config, wiring) {
4349
4247
  language: entry.language.name,
4350
4248
  k1: entry.config.bm25?.k1 ?? 1.2,
4351
4249
  b: entry.config.bm25?.b ?? 0.75,
4352
- ...embedding !== void 0 ? { embedding } : {}
4250
+ ...embedding !== void 0 ? { embedding } : {},
4251
+ ...entry.config.surfaceForms === true ? { surfaceForms: true } : {}
4353
4252
  };
4354
4253
  },
4355
4254
  createIndexFromMetadata: wiring.createIndexFromMetadata,
@@ -5949,10 +5848,15 @@ function highlightField(text, queryTokens, language, options) {
5949
5848
  return qt.token.toLowerCase();
5950
5849
  });
5951
5850
  const matchedRanges = [];
5851
+ const prefixToken = options?.prefixToken;
5952
5852
  for (let i = 0; i < fieldResult.tokens.length; i++) {
5953
5853
  if (i >= charOffsets.length) break;
5954
5854
  const fieldToken = fieldResult.tokens[i].token;
5955
5855
  const stemmedField = language.stemmer ? language.stemmer(fieldToken) : fieldToken;
5856
+ if (prefixToken !== void 0 && fieldToken.startsWith(prefixToken)) {
5857
+ matchedRanges.push({ start: charOffsets[i].start, end: charOffsets[i].end });
5858
+ continue;
5859
+ }
5956
5860
  for (const stemmedQuery of stemmedQueryTokens) {
5957
5861
  if (stemmedField === stemmedQuery) {
5958
5862
  matchedRanges.push({ start: charOffsets[i].start, end: charOffsets[i].end });
@@ -5996,6 +5900,22 @@ function applyHighlights(hits, params, language, config) {
5996
5900
  customTokenizer: config.tokenizer,
5997
5901
  stopWordOverride: config.stopWords
5998
5902
  });
5903
+ let prefixToken;
5904
+ if (params.prefix === true && params.exact !== true && queryTokenResult.tokens.length > 0) {
5905
+ const lastPosition = queryTokenResult.tokens[queryTokenResult.tokens.length - 1].position;
5906
+ const unstemmed = tokenize(params.term ?? "", language, {
5907
+ stem: false,
5908
+ removeStopWords: true,
5909
+ customTokenizer: config.tokenizer,
5910
+ stopWordOverride: config.stopWords
5911
+ });
5912
+ for (const t of unstemmed.tokens) {
5913
+ if (t.position === lastPosition) {
5914
+ prefixToken = t.token;
5915
+ break;
5916
+ }
5917
+ }
5918
+ }
5999
5919
  for (const hit of hits) {
6000
5920
  const highlights = {};
6001
5921
  for (const field of params.highlight.fields) {
@@ -6005,7 +5925,8 @@ function applyHighlights(hits, params, language, config) {
6005
5925
  highlights[field] = highlightField(fieldValue, queryTokenResult.tokens, language, {
6006
5926
  preTag: params.highlight.preTag,
6007
5927
  postTag: params.highlight.postTag,
6008
- maxSnippetLength: params.highlight.maxSnippetLength
5928
+ maxSnippetLength: params.highlight.maxSnippetLength,
5929
+ prefixToken
6009
5930
  });
6010
5931
  }
6011
5932
  }
@@ -6564,8 +6485,8 @@ async function createSnapshot(manager, entry) {
6564
6485
  for (const [fieldPath, vecIndex] of snapshotVecIndexes) {
6565
6486
  vectorPayloads[fieldPath] = vecIndex.serialize();
6566
6487
  }
6567
- const { encode: encode11 } = await import('@msgpack/msgpack');
6568
- return encode11({
6488
+ const { encode: encode10 } = await import('@msgpack/msgpack');
6489
+ return encode10({
6569
6490
  version: 2,
6570
6491
  schema: entry.config.schema,
6571
6492
  language: entry.language.name,
@@ -6577,8 +6498,8 @@ async function restoreFromSnapshot(indexName, data, executor, indexRegistry, get
6577
6498
  if (!(data instanceof Uint8Array)) {
6578
6499
  throw new NarsilError(ErrorCodes.DOC_VALIDATION_FAILED, "Snapshot data must be a Uint8Array");
6579
6500
  }
6580
- const { decode: decode11 } = await import('@msgpack/msgpack');
6581
- const envelope = decode11(data);
6501
+ const { decode: decode10 } = await import('@msgpack/msgpack');
6502
+ const envelope = decode10(data);
6582
6503
  if (envelope.version !== 1 && envelope.version !== 2) {
6583
6504
  throw new NarsilError(
6584
6505
  ErrorCodes.DOC_VALIDATION_FAILED,
@@ -6654,25 +6575,36 @@ function executeSuggest(manager, language, params) {
6654
6575
  return { terms: [], elapsed: performance.now() - t0 };
6655
6576
  }
6656
6577
  const stemmed = language.stemmer ? language.stemmer(lastToken) : lastToken;
6657
- const prefixes = stemmed !== lastToken ? [lastToken, stemmed] : [lastToken];
6658
- const partitions = manager.getAllPartitions();
6659
6578
  const merged = /* @__PURE__ */ new Map();
6660
6579
  const perPartitionLimit = limit * 2;
6661
- for (const partition of partitions) {
6662
- const seen = /* @__PURE__ */ new Set();
6663
- for (const prefix of prefixes) {
6664
- const suggestions = partition.suggestTerms(prefix, perPartitionLimit);
6665
- for (const s of suggestions) {
6666
- if (seen.has(s.term)) continue;
6667
- seen.add(s.term);
6668
- merged.set(s.term, (merged.get(s.term) ?? 0) + s.documentFrequency);
6580
+ for (const partition of manager.getAllPartitions()) {
6581
+ for (const suggestion of partition.suggestTerms(lastToken, stemmed, perPartitionLimit)) {
6582
+ let entry = merged.get(suggestion.token);
6583
+ if (!entry) {
6584
+ entry = { documentFrequency: 0, surfaceOccurrences: /* @__PURE__ */ new Map() };
6585
+ merged.set(suggestion.token, entry);
6586
+ }
6587
+ entry.documentFrequency += suggestion.documentFrequency;
6588
+ for (const s of suggestion.surfaces) {
6589
+ entry.surfaceOccurrences.set(s.surface, (entry.surfaceOccurrences.get(s.surface) ?? 0) + s.occurrences);
6669
6590
  }
6670
6591
  }
6671
6592
  }
6672
- const terms = Array.from(merged.entries()).map(([term, documentFrequency]) => ({ term, documentFrequency })).sort((a, b) => b.documentFrequency - a.documentFrequency);
6593
+ const terms = Array.from(merged.values()).map((entry) => ({ term: pickDisplaySurface(entry.surfaceOccurrences), documentFrequency: entry.documentFrequency })).sort((a, b) => b.documentFrequency - a.documentFrequency || (a.term < b.term ? -1 : 1));
6673
6594
  if (terms.length > limit) terms.length = limit;
6674
6595
  return { terms, elapsed: performance.now() - t0 };
6675
6596
  }
6597
+ function pickDisplaySurface(surfaceOccurrences) {
6598
+ let best = "";
6599
+ let bestCount = -1;
6600
+ for (const [surface, occurrences] of surfaceOccurrences) {
6601
+ if (occurrences > bestCount || occurrences === bestCount && surface < best) {
6602
+ best = surface;
6603
+ bestCount = occurrences;
6604
+ }
6605
+ }
6606
+ return best;
6607
+ }
6676
6608
 
6677
6609
  // src/engine/vector-maintenance.ts
6678
6610
  function resolveVectorIndexes(manager, indexName, fieldName) {
@@ -1,5 +1,5 @@
1
1
  import { b as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-Bo2JQg8b.js';
2
- import { A as AnyDocument, b as ScoringMode, S as SchemaDefinition, I as IndexConfig } from './schema-C3VhNvfw.js';
2
+ import { A as AnyDocument, b as ScoringMode, S as SchemaDefinition, I as IndexConfig } from './schema-DCgkO1j4.js';
3
3
 
4
4
  declare const ErrorCodes: {
5
5
  readonly SCHEMA_INVALID_TYPE: "SCHEMA_INVALID_TYPE";
@@ -156,6 +156,15 @@ interface QueryParams {
156
156
  termMatch?: TermMatchPolicy;
157
157
  tolerance?: number;
158
158
  prefixLength?: number;
159
+ /**
160
+ * Treat the last query token as an unfinished word so it also matches
161
+ * indexed terms that complete it ("secur" matches "security"). Earlier
162
+ * tokens must match fully; `tolerance` keeps applying to them but not to
163
+ * the prefix token. Completions score against a shared document frequency
164
+ * and are demoted below full-word matches. Ignored when `exact` is true.
165
+ * Off by default.
166
+ */
167
+ prefix?: boolean;
159
168
  exact?: boolean;
160
169
  facets?: FacetConfig;
161
170
  sort?: Record<string, 'asc' | 'desc'>;
@@ -1,4 +1,4 @@
1
- export { createDirectExecutor } from './chunk-Q4OVNESD.mjs';
1
+ export { createDirectExecutor } from './chunk-HMO6OMZ3.mjs';
2
2
  import './chunk-S7RJJMHI.mjs';
3
3
  import './chunk-TW6BXTOL.mjs';
4
4
  import './chunk-ALB35PRQ.mjs';
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-CTVVm4GG.js';
2
- import '../../schema-C3VhNvfw.js';
1
+ import { C as ClusterCoordinator } from '../../types-DHX6zGeD.js';
2
+ import '../../schema-DCgkO1j4.js';
3
3
  import '../../adapters-Bo2JQg8b.js';
4
4
 
5
5
  interface EtcdCoordinatorConfig {
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-CTVVm4GG.js';
2
- import '../../schema-C3VhNvfw.js';
1
+ import { C as ClusterCoordinator } from '../../types-DHX6zGeD.js';
2
+ import '../../schema-DCgkO1j4.js';
3
3
  import '../../adapters-Bo2JQg8b.js';
4
4
 
5
5
  declare function createInMemoryCoordinator(): ClusterCoordinator;
@@ -1,7 +1,7 @@
1
- import { C as ClusterCoordinator, N as NodeRegistration, A as AllocationTable, a as NodeRole, b as NodeCapacity } from './types-CTVVm4GG.js';
2
- export { c as AllocationConstraints, d as AllocationEvent, e as NodeEvent, P as PartitionAssignment, f as PartitionState, S as SchemaEvent } from './types-CTVVm4GG.js';
3
- import { B as BatchResult, Q as QueryParams, u as QueryResult, N as NarsilConfig } from './config-DX--2Owg.js';
4
- import { I as IndexConfig, A as AnyDocument } from './schema-C3VhNvfw.js';
1
+ import { C as ClusterCoordinator, N as NodeRegistration, A as AllocationTable, a as NodeRole, b as NodeCapacity } from './types-DHX6zGeD.js';
2
+ export { c as AllocationConstraints, d as AllocationEvent, e as NodeEvent, P as PartitionAssignment, f as PartitionState, S as SchemaEvent } from './types-DHX6zGeD.js';
3
+ import { B as BatchResult, Q as QueryParams, u as QueryResult, N as NarsilConfig } from './config-CojEPOgS.js';
4
+ import { I as IndexConfig, A as AnyDocument } from './schema-DCgkO1j4.js';
5
5
  export { createInMemoryCoordinator } from './distribution/coordinator/in-memory.js';
6
6
  import './adapters-Bo2JQg8b.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  export { createInMemoryCoordinator } from './chunk-RQLXC2YS.mjs';
2
2
  import './chunk-WISGW24C.mjs';
3
- import { ReplicationMessageTypes, ClusterMessageTypes, DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES, createEngineCore, createNarsilFromCore, QueryMessageTypes, applyIndexEntry, applyDeleteEntry, validateEntryPayload, createAckMessage, validateReplicationEntry, MAX_PARTITION_COUNT, MAX_INDEX_NAME_LENGTH, validateIndexName, computeEntryChecksum, createInsyncConfirmMessage, createEntryMessage, getIndexMetadata, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, putIndexMetadata, createForwardMessage } from './chunk-CU6BVZEU.mjs';
4
- import { deserializePayloadV2, createPartitionIndex, getLanguage, fnv1a, mergePartitionStats, MAX_NESTING_DEPTH } from './chunk-Q4OVNESD.mjs';
3
+ import { ReplicationMessageTypes, ClusterMessageTypes, DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES, createEngineCore, createNarsilFromCore, QueryMessageTypes, applyIndexEntry, applyDeleteEntry, validateEntryPayload, createAckMessage, validateReplicationEntry, MAX_PARTITION_COUNT, MAX_INDEX_NAME_LENGTH, validateIndexName, computeEntryChecksum, createInsyncConfirmMessage, createEntryMessage, getIndexMetadata, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, putIndexMetadata, createForwardMessage } from './chunk-MEW7HD75.mjs';
4
+ import { deserializePayloadV2, createPartitionIndex, getLanguage, fnv1a, mergePartitionStats, MAX_NESTING_DEPTH } from './chunk-HMO6OMZ3.mjs';
5
5
  import './chunk-S7RJJMHI.mjs';
6
6
  import { crc32 } from './chunk-KMMJMDUA.mjs';
7
7
  import './chunk-TW6BXTOL.mjs';
@@ -5057,7 +5057,8 @@ async function restoreReplicationPartition(core, engine, indexName, partitionId,
5057
5057
  });
5058
5058
  }
5059
5059
  validatePartitionSnapshotPayload(indexName, partitionId, partitionCount, schema, partition);
5060
- createPartitionIndex(partitionId).deserialize(partition, schema);
5060
+ const trackPositions = core.indexRegistry.get(indexName)?.config.trackPositions ?? true;
5061
+ createPartitionIndex(partitionId, trackPositions).deserialize(partition, schema);
5061
5062
  const restoreIndex = await ensureReplicationIndex(core, engine, indexName, schema, partition.language, partitionCount);
5062
5063
  if (restoreIndex.created) {
5063
5064
  await core.orchestrator.replicateToWorkers({