@delali/narsil 0.3.1-next.128 → 0.3.1-next.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/browser/{chunk-LJS6PREA.mjs → chunk-3NVZD52E.mjs} +3 -1
- package/dist/browser/{chunk-4Y2EGA3U.mjs → chunk-5D6NJD6C.mjs} +554 -127
- package/dist/browser/{chunk-6POI2KNI.mjs → chunk-II5POT55.mjs} +3 -3
- package/dist/browser/{chunk-2CBQ2PCC.mjs → chunk-WLD6DDIX.mjs} +1 -1
- package/dist/browser/{chunk-V5DCQIOT.mjs → chunk-WZBTVTSU.mjs} +2 -2
- package/dist/browser/{chunk-B65QVTST.mjs → chunk-XTFJZHQP.mjs} +14 -9
- package/dist/browser/{chunk-P7C2S5JX.mjs → chunk-YAGXZU4W.mjs} +2 -2
- package/dist/browser/{durability-wiring-PUC4QSCR.mjs → durability-wiring-HCCC6BJB.mjs} +6 -6
- package/dist/browser/{module-ACWDC7YI.mjs → module-S2VDU2JE.mjs} +5 -5
- package/dist/browser/{restore-queue-MLUEUEAN.mjs → restore-queue-BZ7WWEC4.mjs} +1 -1
- package/dist/browser/{runtime-BX6XRFYR.mjs → runtime-PL4TTFJE.mjs} +1 -1
- package/dist/browser/{snapshot-U5Y346XG.mjs → snapshot-RTUCHI2L.mjs} +7 -7
- package/dist/browser/{write-GZHR6AVG.mjs → write-IMU7G5NU.mjs} +5 -5
- package/dist/{capabilities-9YwwCcqP.d.ts → capabilities-BTjv-tK8.d.ts} +10 -3
- package/dist/{chunk-N57XXGPG.mjs → chunk-2HQQ7Y5D.mjs} +23 -4
- package/dist/{chunk-ENBN5VQ6.mjs → chunk-2YOAGAGF.mjs} +115 -46
- package/dist/{chunk-QSCVJJW5.mjs → chunk-37RTD6KD.mjs} +8 -8
- package/dist/{chunk-N6J6EJW3.mjs → chunk-3LJVM6XM.mjs} +2 -2
- package/dist/{chunk-VK45J47R.mjs → chunk-3XHFVYIQ.mjs} +1 -1
- package/dist/{chunk-LOBYK2FG.mjs → chunk-43Q7HAI2.mjs} +20 -9
- package/dist/{chunk-6PN3U6XW.mjs → chunk-44TB6AIZ.mjs} +1 -1
- package/dist/{chunk-6ODIY6ZB.mjs → chunk-4XEVROSP.mjs} +1 -1
- package/dist/{chunk-4IHMMDRF.mjs → chunk-5LC5VMDQ.mjs} +4 -4
- package/dist/{chunk-MFPJVITN.mjs → chunk-5VSTAJET.mjs} +2 -2
- package/dist/{chunk-DG62H7OD.mjs → chunk-AFOZR4ZQ.mjs} +2 -2
- package/dist/{chunk-P34VZEXB.mjs → chunk-AN3CUMPZ.mjs} +2 -2
- package/dist/{chunk-4PQNDHSA.mjs → chunk-CSSCLRGY.mjs} +2 -2
- package/dist/{chunk-HWQDZB2U.mjs → chunk-CTF6WFTX.mjs} +3 -3
- package/dist/{chunk-E74YLAIG.mjs → chunk-DX2FI4LU.mjs} +2 -1
- package/dist/{chunk-22CK2LQO.mjs → chunk-EZIGAOUJ.mjs} +5 -5
- package/dist/{chunk-KCQG2PJT.mjs → chunk-F4UKMTKM.mjs} +4 -4
- package/dist/{chunk-542TD4BL.mjs → chunk-FRSWYMXH.mjs} +1 -1
- package/dist/{chunk-ANFNYCQG.mjs → chunk-J4LRE5Q7.mjs} +6 -6
- package/dist/{chunk-OGFSUXYY.mjs → chunk-K73PZTBR.mjs} +4 -4
- package/dist/{chunk-IBGMFR5Y.mjs → chunk-K76F5YYX.mjs} +274 -75
- package/dist/{chunk-FUUP45IS.mjs → chunk-M6MBSVIJ.mjs} +1 -1
- package/dist/{chunk-IR4KQ4WB.mjs → chunk-MGD7XETB.mjs} +32 -30
- package/dist/{chunk-7ZZQNOIY.mjs → chunk-OPO5SE4J.mjs} +1 -1
- package/dist/{chunk-UKXMSO5H.mjs → chunk-PCRWCOZC.mjs} +155 -31
- package/dist/{chunk-HFJXEFFV.mjs → chunk-PTIJAZWL.mjs} +3 -3
- package/dist/chunk-Q2AP2FSN.mjs +15 -0
- package/dist/{chunk-SEG4CL6W.mjs → chunk-QQS4QZQA.mjs} +4 -4
- package/dist/{chunk-OFYKBKKV.mjs → chunk-RC27KF7F.mjs} +1 -1
- package/dist/{chunk-JEXJDCQH.mjs → chunk-RYH3PASD.mjs} +17 -12
- package/dist/{chunk-IE43SRL3.mjs → chunk-TB7YMDD5.mjs} +10 -6
- package/dist/{chunk-ZR63OGT2.mjs → chunk-TY64A3ZW.mjs} +2 -2
- package/dist/{chunk-Z4DZ4KK2.mjs → chunk-UJWGQIXU.mjs} +1 -0
- package/dist/{chunk-OBWUWZRA.mjs → chunk-WI5Q3L43.mjs} +1 -0
- package/dist/{chunk-SJEIIR56.mjs → chunk-WQYB4TNR.mjs} +2 -2
- package/dist/{chunk-JIXO442E.mjs → chunk-WUIDPBSY.mjs} +16 -10
- package/dist/{chunk-62IPM62F.mjs → chunk-XRXBCOA4.mjs} +2 -2
- package/dist/{chunk-U6NGTWI3.mjs → chunk-XTER67YM.mjs} +1 -1
- package/dist/{chunk-LXWDQLTW.mjs → chunk-Y4NOHICF.mjs} +1 -1
- package/dist/{chunk-OCB7TMUQ.mjs → chunk-Y4US5EGH.mjs} +1 -1
- package/dist/{client-CsuhZ13c.d.ts → client-BOcveV7A.d.ts} +19 -3
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +8 -2
- package/dist/{config-DLVnlByZ.d.ts → config-C3YXk5Rn.d.ts} +2 -2
- package/dist/{config-CtTfxbpV.d.ts → config-CPmIY3aH.d.ts} +2 -2
- package/dist/{direct-executor-6KCVVHYT.mjs → direct-executor-ULA6V5HC.mjs} +12 -12
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +18 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +33 -1
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +71 -43
- package/dist/distribution.mjs +359 -115
- package/dist/{durability-wiring-UGGUNATA.mjs → durability-wiring-6R26AJDI.mjs} +26 -26
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-Bq5wz6c1.d.ts → engine-JjRAXpT3.d.ts} +38 -8
- package/dist/{events-x2aVu0_o.d.ts → events-pM0lna7M.d.ts} +12 -1
- package/dist/{index-Cl5qQauj.d.ts → index-DkQ2DlgR.d.ts} +37 -3
- package/dist/index.browser.mjs +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +19 -19
- package/dist/{long-query-thread-5BIPZVS6.mjs → long-query-thread-6VLA6YJI.mjs} +15 -15
- package/dist/{module-7OHZ2OPI.mjs → module-S4WGMFNW.mjs} +11 -11
- package/dist/partial-words.mjs +6 -6
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +22 -22
- package/dist/react.d.ts +7 -7
- package/dist/react.mjs +1 -0
- package/dist/{rerank-NYX5S7OG.mjs → rerank-V4J4MIWR.mjs} +6 -6
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{restore-queue-NVMWJMHI.mjs → restore-queue-PUGWCPCX.mjs} +1 -1
- package/dist/{runtime-XNYW6AWX.mjs → runtime-TBFBQQQO.mjs} +7 -7
- package/dist/{schema-4W_7tk1f.d.ts → schema-DGAP_8HJ.d.ts} +50 -24
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +27 -15
- package/dist/{snapshot-P7IQGNNQ.mjs → snapshot-PUVSMV7E.mjs} +27 -27
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-DLQIfXqy.d.ts → tasks-txGvNz6h.d.ts} +4 -6
- package/dist/{thread-QPETQEPK.mjs → thread-TA7QQBWP.mjs} +14 -14
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +4 -4
- package/dist/workers/entry.mjs +8 -8
- package/dist/{write-WZVM7ZL6.mjs → write-TGKYT3C4.mjs} +21 -21
- package/package.json +7 -7
package/dist/distribution.mjs
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import { DEFAULT_NODE_LIFECYCLE_CONFIG, bindWriteBlockLookup, bindEngineWriteBlock, bindIndexReads, DEFAULT_CONTROLLER_CONFIG, getIndexMetadata, getClusterIndexConfig, withPartitionCount, validateIndexName,
|
|
2
|
-
import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, DEFAULT_RESUME_WRITES_BELOW, DEFAULT_BLOCK_WRITES_ABOVE, readMemoryFigures, createWritePressure, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, refuseEncodeWithoutRoom, readRecentMemoryFigures, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS,
|
|
3
|
-
export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-
|
|
1
|
+
import { DEFAULT_NODE_LIFECYCLE_CONFIG, bindWriteBlockLookup, bindEngineWriteBlock, bindIndexReads, DEFAULT_CONTROLLER_CONFIG, readIndexMetadataSnapshot, getIndexMetadata, getClusterIndexConfig, withPartitionCount, validateIndexName, metadataWithBm25, indexConfigKey, readIndexState, storeSynonymSet, deleteSynonymSet, indexSettingsOf, putIndexMetadata, isValidInteger, isRecord, isRecord2, decodeIndexSettings, HIDDEN_GENERATION_PREFIX, indexConfigFromSettings, metadataWithSynonymSet, RESHARD_RECORD_CAS_ATTEMPTS, indexUuidOfStoredMetadata, RESHARD_FORWARD_BATCH_DOCUMENTS, storedSynonymSetOf, RESHARD_RETRY_DELAY_MS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_POLL_INTERVAL_MS, ALLOCATION_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_ROUNDS, putIndexReplicationFactor, ALLOCATION_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, MAX_RESHARD_CUTOVER_ATTEMPTS, RECOVERY_CAS_ATTEMPTS, ESTIMATED_PARTITION_BYTES, REBALANCE_THRESHOLD, putGenerationMetadata, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, PARTITION_STORES_TIMEOUT_MS, LEADERSHIP_IMBALANCE_THRESHOLD, BOOTSTRAP_CAS_ATTEMPTS } from './chunk-43Q7HAI2.mjs';
|
|
2
|
+
import { MAX_WAIT_FOR_ACTIVE_REPLICAS, MIN_CONTROLLER_LEASE_TTL_MS, MAX_NODE_LEFT_DELAY_MS, DEFAULT_MAX_PER_SOURCE_SNAPSHOTS, DEFAULT_MAX_STREAMS_PER_INDEX, DEFAULT_CAPACITY, CATCH_UP_TICK_MS, DEFAULT_RESUME_WRITES_BELOW, DEFAULT_BLOCK_WRITES_ABOVE, readMemoryFigures, createWritePressure, WRITE_MEMORY_SAMPLE_MAX_AGE_MS, DEFAULT_IN_FLIGHT_WRITE_FRACTION, MAX_SETTINGS_REPLACEMENT_ATTEMPTS, MAX_DROP_ACKNOWLEDGE_WAIT_MS, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR, DEFAULT_CREATE_INDEX_WAIT_MS, refuseEncodeWithoutRoom, readRecentMemoryFigures, DEFAULT_BOOTSTRAP_SYNC_DEADLINE_MS, DROP_ACKNOWLEDGE_POLL_INTERVAL_MS, COORDINATOR_REQUEST_BUCKET_BOUNDS_SECONDS, COPY_FAILURE_ATTEMPTS, SEARCH_CONTEXT_REAPER_INTERVAL_MS, DECOMMISSION_RECHECK_INTERVAL_MS, answerRefusalOf, withAdmittedWrite, estimateForwardedBytes, CASE_FOLD_EXPANSION_FACTOR, PATTERN_RUN_HEAP_BYTES, ENUM_VALUE_HEAP_BYTES, MAX_SOURCE_ID_LENGTH, DOCUMENT_VALUE_HEAP_BYTES, DOCUMENT_HEAP_BYTES_PER_ESTIMATED_BYTE, DOCUMENT_PROPERTY_HEAP_BYTES, VECTOR_DOCUMENT_HEAP_BYTES, VECTOR_COMPONENT_HEAP_BYTES, NORMALIZATION_EXPANSION_FACTOR, TERM_UNIT_HEAP_BYTES, PARTITION_BYTES_INDEX_OVERHEAD_BYTES, DISTINCT_TERM_HEAP_BYTES, PARTIAL_SPELLING_HEAP_BYTES, PARTITION_BYTES_ENTRY_BYTES, PARTITION_BYTES_REPORT_BUDGET_BYTES, SNAPSHOT_CHUNK_YIELD_INTERVAL_MS, CATCH_UP_FEED_WINDOW_MS, MAX_CATCH_UP_IN_FLIGHT_BYTES, SYNCED_POSITION_REPORT_TIMEOUT_MS, ADMISSION_TIMEOUT_MS, REGISTRATION_LEASE_DRIFT_SHARE, REGISTRATION_LEASE_CONFIRM_TIMEOUT_MS, WRITE_APPLY_YIELD_INTERVAL_MS, ROLLBACK_RETRY_INITIAL_DELAY_MS, ROLLBACK_RETRY_DELAY_CAP_MS, COPY_FAILURE_RETRY_DELAY_MS, FETCH_GROUP_DOCUMENT_IDS, SEARCH_CONTEXT_ENTRY_HEAP_BYTES, FULL_MEMORY_COLLECTION_INTERVAL_MS, MEMORY_SAMPLE_INTERVAL_MS, ANSWER_DECODE_HEAP_BYTES_PER_PAYLOAD_BYTE, CLEAR_PAGE_SIZE, estimateDocumentsBytes, estimateDocumentBytes, PRIMARY_CHANGE_RETRY_WINDOW_MS, PRIMARY_CHANGE_POLL_INTERVAL_MS, PARTITION_WRITE_CONCURRENCY, FORWARD_RETRY_INITIAL_DELAY_MS, FORWARD_RETRY_DELAY_CAP_MS } from './chunk-PTIJAZWL.mjs';
|
|
3
|
+
export { DEFAULT_CAPACITY, DEFAULT_PARTITION_COUNT, DEFAULT_REPLICATION_FACTOR } from './chunk-PTIJAZWL.mjs';
|
|
4
4
|
import { addBackgroundAdmission, workWaitingForMemory } from './chunk-PELHVTO7.mjs';
|
|
5
5
|
import { onRefusalAfterCollection, reservedHeapBytes, reserveHeapBytes, collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal } from './chunk-IWVEG5CX.mjs';
|
|
6
|
-
import { fixedHybridDepthOf, requireWithinHybridDepth, pageByPosition } from './chunk-
|
|
7
|
-
import { closePartitionWriter, replaySyncedWal } from './chunk-
|
|
8
|
-
import { buildArchiveFromMemory, archiveStream, memoryCheckpointStore, readSnapshotArchive } from './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import { indexMetadataOf, loadPartitionSegments, readSegmentManifest, readVectorFile } from './chunk-
|
|
11
|
-
import { decodeVectorFilePayload, bytesToVectors, isDead } from './chunk-
|
|
6
|
+
import { fixedHybridDepthOf, requireWithinHybridDepth, pageByPosition } from './chunk-TY64A3ZW.mjs';
|
|
7
|
+
import { closePartitionWriter, replaySyncedWal } from './chunk-CTF6WFTX.mjs';
|
|
8
|
+
import { buildArchiveFromMemory, archiveStream, memoryCheckpointStore, readSnapshotArchive } from './chunk-J4LRE5Q7.mjs';
|
|
9
|
+
import './chunk-QQS4QZQA.mjs';
|
|
10
|
+
import { indexMetadataOf, loadPartitionSegments, readSegmentManifest, readVectorFile } from './chunk-WUIDPBSY.mjs';
|
|
11
|
+
import { decodeVectorFilePayload, bytesToVectors, isDead } from './chunk-Y4US5EGH.mjs';
|
|
12
12
|
import { CONTROLLER_LEASE_KEY } from './chunk-44W3CBNG.mjs';
|
|
13
13
|
import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
|
|
14
|
-
import './chunk-
|
|
14
|
+
import './chunk-XRXBCOA4.mjs';
|
|
15
15
|
import './chunk-DJHHF2L5.mjs';
|
|
16
16
|
import './chunk-37CD3OKS.mjs';
|
|
17
17
|
import { getPath, getFs } from './chunk-HLPRHOSO.mjs';
|
|
18
|
-
import { createForwardBatchResultMessage, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, readListedFile, optionalIndexUuid, computeEntryChecksum, createPrimaryResignMessage, validateInsyncConfirmPayload, buildEntry, createInsyncRemoveMessage, createEntryBatchMessage, createInsyncConfirmMessage, createEntryMessage, validateAckPayload, createInsyncAddMessage, directoryCheckpointStore, checkpointLastSeqNo, checkpointPrimaryTerm, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage } from './chunk-
|
|
19
|
-
import { applyIndexEntry, applyDeleteEntry, validateReplicationEntry } from './chunk-
|
|
18
|
+
import { createForwardBatchResultMessage, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, readListedFile, optionalIndexUuid, computeEntryChecksum, createPrimaryResignMessage, validateInsyncConfirmPayload, buildEntry, createInsyncRemoveMessage, createEntryBatchMessage, createInsyncConfirmMessage, createEntryMessage, validateAckPayload, createInsyncAddMessage, directoryCheckpointStore, checkpointLastSeqNo, checkpointPrimaryTerm, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage } from './chunk-37RTD6KD.mjs';
|
|
19
|
+
import { applyIndexEntry, applyDeleteEntry, validateReplicationEntry } from './chunk-5LC5VMDQ.mjs';
|
|
20
20
|
import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-P36MUFEJ.mjs';
|
|
21
21
|
import { TransportErrorCodes, ReplicationMessageTypes, ClusterMessageTypes, QueryMessageTypes, TransportError, DEFAULT_TRANSPORT_CONFIG } from './chunk-YH5OIL7B.mjs';
|
|
22
|
-
import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, encodeIndexConfiguration, requireConfigurationWithinSizeLimit, prepareConfiguredSynonyms, createByteReader, openChecksummedEnvelope, emptySerializablePartition, crc32Init, crc32Final, crc32Update, yieldToEventLoop } from './chunk-
|
|
23
|
-
import { runtimeHost, requireSurfaceFormsForPartialFields, now, listBindingOf, clampLimit, hitsKeptPerGroup, queryBindingOf, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-
|
|
24
|
-
import { bindRerankWindowSource, rerankWindowCapOf, providedDocId, engineCoreOf } from './chunk-
|
|
25
|
-
import './chunk-
|
|
22
|
+
import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, applyStoredIndexBm25, createEngineIndex, encodeIndexConfiguration, requireConfigurationWithinSizeLimit, prepareConfiguredSynonyms, createByteReader, openChecksummedEnvelope, emptySerializablePartition, crc32Init, crc32Final, crc32Update, yieldToEventLoop } from './chunk-2YOAGAGF.mjs';
|
|
23
|
+
import { runtimeHost, validateBM25Params, storedBM25Params, requireSurfaceFormsForPartialFields, validateBM25Shape, now, listBindingOf, clampLimit, hitsKeptPerGroup, queryBindingOf, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-PCRWCOZC.mjs';
|
|
24
|
+
import { bindRerankWindowSource, rerankWindowCapOf, providedDocId, engineCoreOf } from './chunk-2HQQ7Y5D.mjs';
|
|
25
|
+
import './chunk-44TB6AIZ.mjs';
|
|
26
26
|
import './chunk-AV4IJKD2.mjs';
|
|
27
|
-
import { synonymModule } from './chunk-
|
|
28
|
-
import { oversampledShardSize, normalizeSort, sortModesOf, readSortValues, resolveProjection, fnv1a, applyProjection, FILTER_EXPRESSION_KEYS, filterTestCount, setNestedValue, FIELD_FILTER_OPERATORS, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, encodePageCursor, requireWithinResultWindow, sortSignatureEntry, fnv1aUint32s, mergePartitionStats } from './chunk-
|
|
29
|
-
import { generateId, getLanguage } from './chunk-
|
|
27
|
+
import { synonymModule } from './chunk-RYH3PASD.mjs';
|
|
28
|
+
import { oversampledShardSize, bm25SetsValue, normalizeSort, sortModesOf, readSortValues, resolveProjection, fnv1a, applyProjection, FILTER_EXPRESSION_KEYS, filterTestCount, setNestedValue, FIELD_FILTER_OPERATORS, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, encodePageCursor, requireWithinResultWindow, sortSignatureEntry, fnv1aUint32s, mergePartitionStats } from './chunk-K76F5YYX.mjs';
|
|
29
|
+
import { generateId, getLanguage } from './chunk-M6MBSVIJ.mjs';
|
|
30
30
|
import './chunk-ZATRDAYU.mjs';
|
|
31
31
|
import './chunk-EBIHRL7B.mjs';
|
|
32
32
|
import './chunk-HJSN7UYG.mjs';
|
|
33
|
-
import { MAX_DOC_ID_LENGTH, BATCH_CHUNK_SIZE, DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING } from './chunk-
|
|
33
|
+
import { MAX_DOC_ID_LENGTH, BATCH_CHUNK_SIZE, DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING } from './chunk-Y4NOHICF.mjs';
|
|
34
34
|
import './chunk-TGP5M5R7.mjs';
|
|
35
35
|
import './chunk-U2BKYEC7.mjs';
|
|
36
36
|
import './chunk-KOKM4PQN.mjs';
|
|
37
37
|
import { MIN_OVERSAMPLE } from './chunk-QSK35UC2.mjs';
|
|
38
|
-
import './chunk-
|
|
39
|
-
import { isPatternTolerance } from './chunk-
|
|
38
|
+
import './chunk-3XHFVYIQ.mjs';
|
|
39
|
+
import { isPatternTolerance } from './chunk-AN3CUMPZ.mjs';
|
|
40
40
|
import { MAX_FILTER_DEPTH, MAX_FILTER_TESTS, MAX_FILTER_ARRAY_SIZE } from './chunk-WQBCBKY3.mjs';
|
|
41
|
-
import { getNestedValue } from './chunk-
|
|
42
|
-
import { encodeDocument, validateSchema, requireCreatableSchema, encodeDocumentReply, schemaFieldsOf, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES } from './chunk-
|
|
41
|
+
import { getNestedValue } from './chunk-F4UKMTKM.mjs';
|
|
42
|
+
import { encodeDocument, validateSchema, requireCreatableSchema, encodeDocumentReply, schemaFieldsOf, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES } from './chunk-AFOZR4ZQ.mjs';
|
|
43
43
|
import { MAX_DOCUMENT_ENCODING_DEPTH } from './chunk-U476IXKQ.mjs';
|
|
44
|
-
import { MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, MAX_TOLERANCE, MAX_PREFIX_LENGTH, RESULT_WINDOW, MIN_HYBRID_DEPTH, MAX_HYBRID_DEPTH, DEFAULT_PAGE_SIZE, HYBRID_RESCORE_WINDOW } from './chunk-
|
|
44
|
+
import { MAX_SORT_FIELDS, MAX_CURSOR_LENGTH, MAX_TOLERANCE, MAX_PREFIX_LENGTH, RESULT_WINDOW, MIN_HYBRID_DEPTH, MAX_HYBRID_DEPTH, DEFAULT_PAGE_SIZE, HYBRID_RESCORE_WINDOW } from './chunk-DX2FI4LU.mjs';
|
|
45
45
|
import './chunk-VJS4JFBQ.mjs';
|
|
46
46
|
import './chunk-GES7U2PM.mjs';
|
|
47
|
-
import './chunk-
|
|
48
|
-
import { resolveIndexAnalysis } from './chunk-
|
|
47
|
+
import './chunk-4XEVROSP.mjs';
|
|
48
|
+
import { resolveIndexAnalysis } from './chunk-MGD7XETB.mjs';
|
|
49
49
|
import './chunk-X5CV2E2B.mjs';
|
|
50
50
|
import './chunk-7X5JST5L.mjs';
|
|
51
|
-
import './chunk-
|
|
51
|
+
import './chunk-RC27KF7F.mjs';
|
|
52
52
|
import { isSortMode, SORT_MODES, toComparableSortValue, compareComparableKeys, compareSortValues } from './chunk-R6A773WK.mjs';
|
|
53
53
|
import { compareCodePoints, exceedsCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
54
54
|
import { collectAndReturnPages } from './chunk-RIIUZJQ3.mjs';
|
|
55
|
-
import './chunk-
|
|
56
|
-
import './chunk-
|
|
55
|
+
import './chunk-UJWGQIXU.mjs';
|
|
56
|
+
import './chunk-XTER67YM.mjs';
|
|
57
57
|
import { HEAP_RESUME_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE, HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-22YPZVMG.mjs';
|
|
58
58
|
import './chunk-RFBLQLLZ.mjs';
|
|
59
59
|
import { MAX_STORED_VECTOR_DIMENSION, MAX_NESTING_DEPTH } from './chunk-L5ORED7V.mjs';
|
|
60
|
-
import { ErrorCodes, NarsilError, describeError, ServerErrorCodes } from './chunk-
|
|
60
|
+
import { ErrorCodes, NarsilError, describeError, ServerErrorCodes } from './chunk-WI5Q3L43.mjs';
|
|
61
61
|
import { encode, decode } from '@msgpack/msgpack';
|
|
62
62
|
import { randomUUID } from 'crypto';
|
|
63
63
|
import { openSync, writeSync, closeSync, rmSync, readSync } from 'fs';
|
|
@@ -727,8 +727,23 @@ async function stopRegistrationHeartbeat(state) {
|
|
|
727
727
|
}
|
|
728
728
|
|
|
729
729
|
// src/distribution/cluster/version.ts
|
|
730
|
-
var SPEC_VERSION = "1.
|
|
730
|
+
var SPEC_VERSION = "1.1";
|
|
731
|
+
var BM25_TUNING_SPEC_VERSION = "1.1";
|
|
731
732
|
var VERSION_PATTERN = /^(\d+)\.(\d+)$/;
|
|
733
|
+
function versionPartsOf(version) {
|
|
734
|
+
const match = VERSION_PATTERN.exec(version);
|
|
735
|
+
if (match === null) return null;
|
|
736
|
+
const major = Number(match[1]);
|
|
737
|
+
const minor = Number(match[2]);
|
|
738
|
+
return Number.isSafeInteger(major) && Number.isSafeInteger(minor) ? [major, minor] : null;
|
|
739
|
+
}
|
|
740
|
+
function reachesVersion(version, minimum) {
|
|
741
|
+
if (typeof version !== "string") return false;
|
|
742
|
+
const parts = versionPartsOf(version);
|
|
743
|
+
const required = versionPartsOf(minimum);
|
|
744
|
+
if (parts === null || required === null) return false;
|
|
745
|
+
return parts[0] > required[0] || parts[0] === required[0] && parts[1] >= required[1];
|
|
746
|
+
}
|
|
732
747
|
function majorOf(version) {
|
|
733
748
|
const match = VERSION_PATTERN.exec(version);
|
|
734
749
|
if (match === null) return null;
|
|
@@ -1071,6 +1086,88 @@ async function openSnapshotSpoolDirectory(durabilityDirectory) {
|
|
|
1071
1086
|
}
|
|
1072
1087
|
return { path, dispose: () => rm(path, { recursive: true, force: true }) };
|
|
1073
1088
|
}
|
|
1089
|
+
function settingOfMetadata(bytes, indexName) {
|
|
1090
|
+
const decoded = decode(bytes);
|
|
1091
|
+
if (!isRecord2(decoded) || typeof decoded.indexUuid !== "string") return null;
|
|
1092
|
+
const settings = decodeIndexSettings(decoded.settings, indexName);
|
|
1093
|
+
return { indexUuid: decoded.indexUuid, bm25: settings?.bm25, revision: settings?.bm25Revision };
|
|
1094
|
+
}
|
|
1095
|
+
function isLaterThan(next, held) {
|
|
1096
|
+
return (next.revision ?? 0) > (held.revision ?? 0);
|
|
1097
|
+
}
|
|
1098
|
+
function createBm25View(deps) {
|
|
1099
|
+
const { coordinator, engine, onError } = deps;
|
|
1100
|
+
const held = /* @__PURE__ */ new Map();
|
|
1101
|
+
let unwatch = null;
|
|
1102
|
+
function applyToLocalCopy(indexName, indexUuid) {
|
|
1103
|
+
if (engine.indexUuidOf(indexName) !== indexUuid) return Promise.resolve();
|
|
1104
|
+
return engine.applyStoredBm25(indexName, () => {
|
|
1105
|
+
const latest = held.get(indexName);
|
|
1106
|
+
if (latest === void 0 || latest.indexUuid !== indexUuid) return null;
|
|
1107
|
+
return engine.indexUuidOf(indexName) === indexUuid ? { bm25: latest.bm25 } : null;
|
|
1108
|
+
}).then(
|
|
1109
|
+
() => void 0,
|
|
1110
|
+
(error) => {
|
|
1111
|
+
if (error instanceof NarsilError && error.code === ErrorCodes.INDEX_NOT_FOUND) return;
|
|
1112
|
+
onError(error);
|
|
1113
|
+
}
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
function hold(indexName, next) {
|
|
1117
|
+
const current = held.get(indexName);
|
|
1118
|
+
if (current !== void 0 && current.indexUuid === next.indexUuid && !isLaterThan(next, current)) return false;
|
|
1119
|
+
held.set(indexName, next);
|
|
1120
|
+
return true;
|
|
1121
|
+
}
|
|
1122
|
+
function receive(indexName, metadata) {
|
|
1123
|
+
if (metadata === null) {
|
|
1124
|
+
held.delete(indexName);
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
let next;
|
|
1128
|
+
try {
|
|
1129
|
+
next = settingOfMetadata(metadata, indexName);
|
|
1130
|
+
} catch (error) {
|
|
1131
|
+
onError(error);
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if (next !== null && hold(indexName, next)) void applyToLocalCopy(indexName, next.indexUuid);
|
|
1135
|
+
}
|
|
1136
|
+
return {
|
|
1137
|
+
held: (indexName) => held.get(indexName),
|
|
1138
|
+
async current(indexName) {
|
|
1139
|
+
const known = held.get(indexName);
|
|
1140
|
+
if (known !== void 0) return known;
|
|
1141
|
+
const snapshot = await readIndexMetadataSnapshot(coordinator, indexName);
|
|
1142
|
+
if (snapshot === null) return null;
|
|
1143
|
+
const read = {
|
|
1144
|
+
indexUuid: snapshot.record.indexUuid,
|
|
1145
|
+
bm25: snapshot.settings?.bm25,
|
|
1146
|
+
revision: snapshot.settings?.bm25Revision
|
|
1147
|
+
};
|
|
1148
|
+
const racing = held.get(indexName);
|
|
1149
|
+
if (racing === void 0 || racing.indexUuid === read.indexUuid && isLaterThan(read, racing)) {
|
|
1150
|
+
held.set(indexName, read);
|
|
1151
|
+
return read;
|
|
1152
|
+
}
|
|
1153
|
+
return racing;
|
|
1154
|
+
},
|
|
1155
|
+
async start() {
|
|
1156
|
+
if (unwatch !== null) return;
|
|
1157
|
+
unwatch = await coordinator.watchIndexMetadata((event) => receive(event.indexName, event.metadata));
|
|
1158
|
+
},
|
|
1159
|
+
stop() {
|
|
1160
|
+
unwatch?.();
|
|
1161
|
+
unwatch = null;
|
|
1162
|
+
held.clear();
|
|
1163
|
+
},
|
|
1164
|
+
async applyWritten(indexName, written) {
|
|
1165
|
+
hold(indexName, written);
|
|
1166
|
+
await applyToLocalCopy(indexName, written.indexUuid);
|
|
1167
|
+
},
|
|
1168
|
+
applyToLocalCopy
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1074
1171
|
|
|
1075
1172
|
// src/distribution/cluster-node/local-index-gone.ts
|
|
1076
1173
|
function localIndexIsGone(err) {
|
|
@@ -8315,6 +8412,7 @@ async function createClusterLocalEngine(config, hooks) {
|
|
|
8315
8412
|
indexUuidOf: (indexName) => core.indexRegistry.get(indexName)?.indexUuid,
|
|
8316
8413
|
stampIndexUuid: (indexName, indexUuid) => stampIndexUuid(core, indexName, indexUuid),
|
|
8317
8414
|
applyStoredSynonyms: (indexName, load) => synonymModule().applyLoaded(core, indexName, load),
|
|
8415
|
+
applyStoredBm25: (indexName, load) => applyStoredIndexBm25(core, indexName, load),
|
|
8318
8416
|
highestPersistedSeqNoOf: (indexName, partitionId) => core.durability?.manager.highestPersistedSeqNo(indexName, partitionId) ?? 0,
|
|
8319
8417
|
persistedPositionOf: (indexName, partitionId) => persistedPositionOf(core, indexName, partitionId),
|
|
8320
8418
|
numberEntriesWith: (numbering, defersCommit) => core.durability?.manager.numberEntriesWith?.(numbering, defersCommit),
|
|
@@ -8341,13 +8439,14 @@ async function createClusterLocalEngine(config, hooks) {
|
|
|
8341
8439
|
partitionCount,
|
|
8342
8440
|
writeRecords
|
|
8343
8441
|
}),
|
|
8344
|
-
queryPartitions: (indexName, params, partitionIds, globalStats, rescoreWindow, snapshots) => runEngineQuery(core, indexName, params, {
|
|
8442
|
+
queryPartitions: (indexName, params, partitionIds, globalStats, rescoreWindow, snapshots, indexBm25) => runEngineQuery(core, indexName, params, {
|
|
8345
8443
|
partitionIds,
|
|
8346
8444
|
globalStats,
|
|
8347
8445
|
rescoreWindow,
|
|
8446
|
+
indexBm25,
|
|
8348
8447
|
onRanked: snapshots === void 0 ? void 0 : (manager, result) => snapshotRankedDocuments(manager, result, snapshots)
|
|
8349
8448
|
}),
|
|
8350
|
-
preflightPartitions: (indexName, params, partitionIds) => runEnginePreflight(core, indexName, params, { partitionIds }),
|
|
8449
|
+
preflightPartitions: (indexName, params, partitionIds, indexBm25) => runEnginePreflight(core, indexName, params, { partitionIds, indexBm25 }),
|
|
8351
8450
|
suggestPartitions: (indexName, params, partitionIds) => runEngineSuggest(core, indexName, params, partitionIds),
|
|
8352
8451
|
listPartitions: (indexName, params, partitionIds) => runEngineListDocuments(core, indexName, params, partitionIds),
|
|
8353
8452
|
collectQueryStats: (indexName, terms, partitionIds, scope) => runEngineQueryStats(core, indexName, terms, partitionIds, scope),
|
|
@@ -8472,7 +8571,7 @@ var NULL_BYTE = String.fromCharCode(0);
|
|
|
8472
8571
|
function throwInvalid(code, message, details) {
|
|
8473
8572
|
throw new NarsilError(code, message, details);
|
|
8474
8573
|
}
|
|
8475
|
-
function
|
|
8574
|
+
function isRecord3(value) {
|
|
8476
8575
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8477
8576
|
}
|
|
8478
8577
|
function isInteger(value) {
|
|
@@ -8588,14 +8687,14 @@ function validateIndexNameField(value, fieldLabel) {
|
|
|
8588
8687
|
return value;
|
|
8589
8688
|
}
|
|
8590
8689
|
function validateDocumentId(value, fieldLabel) {
|
|
8591
|
-
if (!
|
|
8690
|
+
if (!isRecord3(value)) {
|
|
8592
8691
|
throwInvalid(CONFIG_INVALID, `Invalid FetchPayload: "${fieldLabel}" must be an object`);
|
|
8593
8692
|
}
|
|
8594
8693
|
validateStringField(value.docId, `${fieldLabel}.docId`, MAX_DOC_ID_LENGTH, CONFIG_INVALID);
|
|
8595
8694
|
validatePartitionId(value.partitionId, `${fieldLabel}.partitionId`, CONFIG_INVALID);
|
|
8596
8695
|
}
|
|
8597
8696
|
function validateHighlightConfig(value) {
|
|
8598
|
-
if (!
|
|
8697
|
+
if (!isRecord3(value)) {
|
|
8599
8698
|
throwInvalid(CONFIG_INVALID, 'Invalid FetchPayload: "highlight" must be an object or null');
|
|
8600
8699
|
}
|
|
8601
8700
|
if (value.fields !== null) {
|
|
@@ -8621,7 +8720,7 @@ function validateHighlightConfig(value) {
|
|
|
8621
8720
|
}
|
|
8622
8721
|
}
|
|
8623
8722
|
function validateFetchPayload(decoded) {
|
|
8624
|
-
if (!
|
|
8723
|
+
if (!isRecord3(decoded)) {
|
|
8625
8724
|
throwInvalid(CONFIG_INVALID, "Invalid FetchPayload: expected an object");
|
|
8626
8725
|
}
|
|
8627
8726
|
validateIndexNameField(decoded.indexName, "indexName");
|
|
@@ -8653,7 +8752,7 @@ function validateFetchPayload(decoded) {
|
|
|
8653
8752
|
return decoded;
|
|
8654
8753
|
}
|
|
8655
8754
|
function validateFetchResultPayload(decoded) {
|
|
8656
|
-
if (!
|
|
8755
|
+
if (!isRecord3(decoded)) {
|
|
8657
8756
|
throwInvalid(CONFIG_INVALID, "Invalid FetchResultPayload: expected an object");
|
|
8658
8757
|
}
|
|
8659
8758
|
if (!Array.isArray(decoded.documents)) {
|
|
@@ -8661,14 +8760,14 @@ function validateFetchResultPayload(decoded) {
|
|
|
8661
8760
|
}
|
|
8662
8761
|
for (let i = 0; i < decoded.documents.length; i++) {
|
|
8663
8762
|
const doc = decoded.documents[i];
|
|
8664
|
-
if (!
|
|
8763
|
+
if (!isRecord3(doc)) {
|
|
8665
8764
|
throwInvalid(CONFIG_INVALID, `Invalid FetchResultPayload: "documents[${i}]" must be an object`);
|
|
8666
8765
|
}
|
|
8667
8766
|
validateStringField(doc.docId, `documents[${i}].docId`, MAX_DOC_ID_LENGTH, CONFIG_INVALID);
|
|
8668
|
-
if (!
|
|
8767
|
+
if (!isRecord3(doc.document)) {
|
|
8669
8768
|
throwInvalid(CONFIG_INVALID, `Invalid FetchResultPayload: "documents[${i}].document" must be an object`);
|
|
8670
8769
|
}
|
|
8671
|
-
if (doc.highlights !== null && !
|
|
8770
|
+
if (doc.highlights !== null && !isRecord3(doc.highlights)) {
|
|
8672
8771
|
throwInvalid(CONFIG_INVALID, `Invalid FetchResultPayload: "documents[${i}].highlights" must be an object or null`);
|
|
8673
8772
|
}
|
|
8674
8773
|
}
|
|
@@ -8785,7 +8884,7 @@ function isKnownLeafKey(key) {
|
|
|
8785
8884
|
return FIELD_FILTER_OPERATORS.includes(key);
|
|
8786
8885
|
}
|
|
8787
8886
|
function validateGeoRadius(value, fieldLabel, errorCode) {
|
|
8788
|
-
if (!
|
|
8887
|
+
if (!isRecord3(value)) {
|
|
8789
8888
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
8790
8889
|
}
|
|
8791
8890
|
validateCoordinates(value.lat, value.lon, fieldLabel, errorCode);
|
|
@@ -8804,7 +8903,7 @@ function validateGeoRadius(value, fieldLabel, errorCode) {
|
|
|
8804
8903
|
}
|
|
8805
8904
|
}
|
|
8806
8905
|
function validateGeoPolygon(value, fieldLabel, errorCode) {
|
|
8807
|
-
if (!
|
|
8906
|
+
if (!isRecord3(value)) {
|
|
8808
8907
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
8809
8908
|
}
|
|
8810
8909
|
if (!Array.isArray(value.points)) {
|
|
@@ -8827,7 +8926,7 @@ function validateGeoPolygon(value, fieldLabel, errorCode) {
|
|
|
8827
8926
|
}
|
|
8828
8927
|
for (let i = 0; i < points.length; i++) {
|
|
8829
8928
|
const point = points[i];
|
|
8830
|
-
if (!
|
|
8929
|
+
if (!isRecord3(point)) {
|
|
8831
8930
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}.points[${i}]" must be an object`);
|
|
8832
8931
|
}
|
|
8833
8932
|
validateCoordinates(point.lat, point.lon, `${fieldLabel}.points[${i}]`, errorCode);
|
|
@@ -8877,7 +8976,7 @@ function validateLeafOperator(opKey, opValue, leafLabel, errorCode) {
|
|
|
8877
8976
|
return;
|
|
8878
8977
|
}
|
|
8879
8978
|
if (opKey === "size") {
|
|
8880
|
-
if (!
|
|
8979
|
+
if (!isRecord3(opValue)) {
|
|
8881
8980
|
throwInvalid(errorCode, `Invalid payload: "${opLabel}" must be an object`);
|
|
8882
8981
|
}
|
|
8883
8982
|
for (const [innerKey, innerValue] of Object.entries(opValue)) {
|
|
@@ -8899,7 +8998,7 @@ function validateLeafOperator(opKey, opValue, leafLabel, errorCode) {
|
|
|
8899
8998
|
throwInvalid(errorCode, `Invalid payload: "${leafLabel}" contains unsupported operator "${opKey}"`);
|
|
8900
8999
|
}
|
|
8901
9000
|
function validateFieldFilter(value, fieldLabel, errorCode) {
|
|
8902
|
-
if (!
|
|
9001
|
+
if (!isRecord3(value)) {
|
|
8903
9002
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
8904
9003
|
}
|
|
8905
9004
|
const entries = Object.entries(value);
|
|
@@ -8917,7 +9016,7 @@ function validateFieldFilter(value, fieldLabel, errorCode) {
|
|
|
8917
9016
|
}
|
|
8918
9017
|
}
|
|
8919
9018
|
function validateFieldsRecord(value, fieldLabel, errorCode) {
|
|
8920
|
-
if (!
|
|
9019
|
+
if (!isRecord3(value)) {
|
|
8921
9020
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
8922
9021
|
}
|
|
8923
9022
|
const entries = Object.entries(value);
|
|
@@ -8960,7 +9059,7 @@ function validateFilterExpression(value, fieldLabel, errorCode = SEARCH_INVALID_
|
|
|
8960
9059
|
limit: MAX_FILTER_DEPTH
|
|
8961
9060
|
});
|
|
8962
9061
|
}
|
|
8963
|
-
if (!
|
|
9062
|
+
if (!isRecord3(value)) {
|
|
8964
9063
|
throwInvalid(errorCode, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
8965
9064
|
}
|
|
8966
9065
|
const entries = Object.entries(value);
|
|
@@ -9001,7 +9100,7 @@ var ALLOWED_FACET_ORDERS = ["asc", "desc"];
|
|
|
9001
9100
|
var ALLOWED_METRICS = ["cosine", "dotProduct", "euclidean"];
|
|
9002
9101
|
var ALLOWED_HYBRID_STRATEGIES = ["rrf", "linear"];
|
|
9003
9102
|
function validateHybridParams(value) {
|
|
9004
|
-
if (!
|
|
9103
|
+
if (!isRecord3(value)) {
|
|
9005
9104
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params.hybrid" must be an object');
|
|
9006
9105
|
}
|
|
9007
9106
|
if (!Object.hasOwn(value, "depth")) value.depth = null;
|
|
@@ -9031,7 +9130,7 @@ function validateHybridParams(value) {
|
|
|
9031
9130
|
}
|
|
9032
9131
|
}
|
|
9033
9132
|
function validateGroupParams(value) {
|
|
9034
|
-
if (!
|
|
9133
|
+
if (!isRecord3(value)) {
|
|
9035
9134
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params.group" must be an object');
|
|
9036
9135
|
}
|
|
9037
9136
|
const fields = validateStringArray(
|
|
@@ -9070,7 +9169,7 @@ function validateFacetRanges(value, fieldLabel) {
|
|
|
9070
9169
|
}
|
|
9071
9170
|
for (let i = 0; i < value.length; i++) {
|
|
9072
9171
|
const range = value[i];
|
|
9073
|
-
if (!
|
|
9172
|
+
if (!isRecord3(range) || typeof range.from !== "number" || typeof range.to !== "number") {
|
|
9074
9173
|
throwInvalid(CONFIG_INVALID, `Invalid SearchPayload: "${fieldLabel}[${i}]" must hold a numeric from and to`);
|
|
9075
9174
|
}
|
|
9076
9175
|
}
|
|
@@ -9091,7 +9190,7 @@ function validateFacetParams(value) {
|
|
|
9091
9190
|
}
|
|
9092
9191
|
for (let i = 0; i < value.length; i++) {
|
|
9093
9192
|
const entry = value[i];
|
|
9094
|
-
if (!
|
|
9193
|
+
if (!isRecord3(entry)) {
|
|
9095
9194
|
throwInvalid(CONFIG_INVALID, `Invalid SearchPayload: "params.facets[${i}]" must be an object`);
|
|
9096
9195
|
}
|
|
9097
9196
|
validateFieldName(entry.field, `params.facets[${i}].field`, SEARCH_INVALID_FIELD);
|
|
@@ -9146,7 +9245,7 @@ function validatePinnedParam(value) {
|
|
|
9146
9245
|
}
|
|
9147
9246
|
for (let i = 0; i < value.length; i++) {
|
|
9148
9247
|
const entry = value[i];
|
|
9149
|
-
if (!
|
|
9248
|
+
if (!isRecord3(entry)) {
|
|
9150
9249
|
throwInvalid(CONFIG_INVALID, `Invalid SearchPayload: "params.pinned[${i}]" must be an object`);
|
|
9151
9250
|
}
|
|
9152
9251
|
if (typeof entry.docId !== "string" || entry.docId.length === 0 || entry.docId.length > MAX_DOC_ID_LENGTH) {
|
|
@@ -9216,7 +9315,7 @@ function validateIndexNameField2(value, fieldLabel) {
|
|
|
9216
9315
|
return value;
|
|
9217
9316
|
}
|
|
9218
9317
|
function validateVectorParams(value) {
|
|
9219
|
-
if (!
|
|
9318
|
+
if (!isRecord3(value)) {
|
|
9220
9319
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params.vector" must be an object');
|
|
9221
9320
|
}
|
|
9222
9321
|
if (!Object.hasOwn(value, "rescoreWindow")) value.rescoreWindow = null;
|
|
@@ -9289,7 +9388,7 @@ function validateSortParams(value) {
|
|
|
9289
9388
|
}
|
|
9290
9389
|
for (let i = 0; i < value.length; i++) {
|
|
9291
9390
|
const entry = value[i];
|
|
9292
|
-
if (!
|
|
9391
|
+
if (!isRecord3(entry)) {
|
|
9293
9392
|
throwInvalid(CONFIG_INVALID, `Invalid SearchPayload: "params.sort[${i}]" must be an object`);
|
|
9294
9393
|
}
|
|
9295
9394
|
validateFieldName(entry.field, `params.sort[${i}].field`, SEARCH_INVALID_FIELD);
|
|
@@ -9308,7 +9407,7 @@ function validateSortParams(value) {
|
|
|
9308
9407
|
}
|
|
9309
9408
|
}
|
|
9310
9409
|
function validateBoostParams(value) {
|
|
9311
|
-
if (!
|
|
9410
|
+
if (!isRecord3(value)) {
|
|
9312
9411
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params.boost" must be an object or null');
|
|
9313
9412
|
}
|
|
9314
9413
|
const entries = Object.entries(value);
|
|
@@ -9327,16 +9426,16 @@ function validateBoostParams(value) {
|
|
|
9327
9426
|
}
|
|
9328
9427
|
}
|
|
9329
9428
|
function validateGlobalStatsShape(value) {
|
|
9330
|
-
if (!
|
|
9429
|
+
if (!isRecord3(value)) {
|
|
9331
9430
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "globalStats" must be an object or null');
|
|
9332
9431
|
}
|
|
9333
9432
|
if (!isFiniteNumber(value.totalDocuments) || value.totalDocuments < 0) {
|
|
9334
9433
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "globalStats.totalDocuments" must be a non-negative number');
|
|
9335
9434
|
}
|
|
9336
|
-
if (!
|
|
9435
|
+
if (!isRecord3(value.docFrequencies)) {
|
|
9337
9436
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "globalStats.docFrequencies" must be an object');
|
|
9338
9437
|
}
|
|
9339
|
-
if (!
|
|
9438
|
+
if (!isRecord3(value.totalFieldLengths)) {
|
|
9340
9439
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "globalStats.totalFieldLengths" must be an object');
|
|
9341
9440
|
}
|
|
9342
9441
|
}
|
|
@@ -9396,6 +9495,8 @@ function validateParams(params) {
|
|
|
9396
9495
|
if (params.boost !== null) {
|
|
9397
9496
|
validateBoostParams(params.boost);
|
|
9398
9497
|
}
|
|
9498
|
+
if (params.bm25 !== void 0 && params.bm25 !== null) validateBM25Shape(params.bm25, "settable");
|
|
9499
|
+
if (params.indexBm25 !== void 0 && params.indexBm25 !== null) validateBM25Shape(params.indexBm25, "stored");
|
|
9399
9500
|
if (params.tolerance !== null) {
|
|
9400
9501
|
if (!isInteger(params.tolerance) || params.tolerance < 0 || params.tolerance > MAX_TOLERANCE) {
|
|
9401
9502
|
throwInvalid(
|
|
@@ -9447,18 +9548,18 @@ function validateParams(params) {
|
|
|
9447
9548
|
}
|
|
9448
9549
|
}
|
|
9449
9550
|
function validateWireParams(params) {
|
|
9450
|
-
if (!
|
|
9551
|
+
if (!isRecord3(params)) {
|
|
9451
9552
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params" must be an object');
|
|
9452
9553
|
}
|
|
9453
9554
|
validateParams(params);
|
|
9454
9555
|
}
|
|
9455
9556
|
function validateSearchPayload(decoded) {
|
|
9456
|
-
if (!
|
|
9557
|
+
if (!isRecord3(decoded)) {
|
|
9457
9558
|
throwInvalid(CONFIG_INVALID, "Invalid SearchPayload: expected an object");
|
|
9458
9559
|
}
|
|
9459
9560
|
validateIndexNameField2(decoded.indexName, "indexName");
|
|
9460
9561
|
validatePartitionIdsArray(decoded.partitionIds, "partitionIds", CONFIG_INVALID);
|
|
9461
|
-
if (!
|
|
9562
|
+
if (!isRecord3(decoded.params)) {
|
|
9462
9563
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchPayload: "params" must be an object');
|
|
9463
9564
|
}
|
|
9464
9565
|
validateParams(decoded.params);
|
|
@@ -9494,7 +9595,7 @@ function validateIndexNameField3(decoded, payloadLabel) {
|
|
|
9494
9595
|
validateStringField(decoded.indexName, `${payloadLabel}.indexName`, 255, CONFIG_INVALID);
|
|
9495
9596
|
}
|
|
9496
9597
|
function validateCountPayload(decoded) {
|
|
9497
|
-
if (!
|
|
9598
|
+
if (!isRecord3(decoded)) {
|
|
9498
9599
|
throwInvalid(CONFIG_INVALID, "Invalid CountPayload: expected an object");
|
|
9499
9600
|
}
|
|
9500
9601
|
validateIndexNameField3(decoded, "CountPayload");
|
|
@@ -9502,7 +9603,7 @@ function validateCountPayload(decoded) {
|
|
|
9502
9603
|
return decoded;
|
|
9503
9604
|
}
|
|
9504
9605
|
function validateCountResultPayload(decoded) {
|
|
9505
|
-
if (!
|
|
9606
|
+
if (!isRecord3(decoded)) {
|
|
9506
9607
|
throwInvalid(CONFIG_INVALID, "Invalid CountResultPayload: expected an object");
|
|
9507
9608
|
}
|
|
9508
9609
|
if (!Array.isArray(decoded.partitions)) {
|
|
@@ -9510,7 +9611,7 @@ function validateCountResultPayload(decoded) {
|
|
|
9510
9611
|
}
|
|
9511
9612
|
for (let i = 0; i < decoded.partitions.length; i++) {
|
|
9512
9613
|
const entry = decoded.partitions[i];
|
|
9513
|
-
if (!
|
|
9614
|
+
if (!isRecord3(entry)) {
|
|
9514
9615
|
throwInvalid(CONFIG_INVALID, `Invalid CountResultPayload: "partitions[${i}]" must be an object`);
|
|
9515
9616
|
}
|
|
9516
9617
|
validateNonNegativeInteger(entry.partitionId, `partitions[${i}].partitionId`, MAX_COUNT_VALUE, CONFIG_INVALID);
|
|
@@ -9537,7 +9638,7 @@ function validateListSort(value) {
|
|
|
9537
9638
|
}
|
|
9538
9639
|
for (let i = 0; i < value.length; i++) {
|
|
9539
9640
|
const entry = value[i];
|
|
9540
|
-
if (!
|
|
9641
|
+
if (!isRecord3(entry)) {
|
|
9541
9642
|
throwInvalid(CONFIG_INVALID, `Invalid ListPayload: "sort[${i}]" must be an object`);
|
|
9542
9643
|
}
|
|
9543
9644
|
validateFieldName(entry.field, `sort[${i}].field`, SEARCH_INVALID_FIELD);
|
|
@@ -9553,7 +9654,7 @@ function validateListSort(value) {
|
|
|
9553
9654
|
}
|
|
9554
9655
|
}
|
|
9555
9656
|
function validateListPayload(decoded) {
|
|
9556
|
-
if (!
|
|
9657
|
+
if (!isRecord3(decoded)) {
|
|
9557
9658
|
throwInvalid(CONFIG_INVALID, "Invalid ListPayload: expected an object");
|
|
9558
9659
|
}
|
|
9559
9660
|
validateIndexNameField3(decoded, "ListPayload");
|
|
@@ -9598,7 +9699,7 @@ function validateSortValues(value, fieldLabel) {
|
|
|
9598
9699
|
}
|
|
9599
9700
|
}
|
|
9600
9701
|
function validateListResultPayload(decoded) {
|
|
9601
|
-
if (!
|
|
9702
|
+
if (!isRecord3(decoded)) {
|
|
9602
9703
|
throwInvalid(CONFIG_INVALID, "Invalid ListResultPayload: expected an object");
|
|
9603
9704
|
}
|
|
9604
9705
|
if (!Array.isArray(decoded.entries)) {
|
|
@@ -9609,11 +9710,11 @@ function validateListResultPayload(decoded) {
|
|
|
9609
9710
|
}
|
|
9610
9711
|
for (let i = 0; i < decoded.entries.length; i++) {
|
|
9611
9712
|
const entry = decoded.entries[i];
|
|
9612
|
-
if (!
|
|
9713
|
+
if (!isRecord3(entry)) {
|
|
9613
9714
|
throwInvalid(CONFIG_INVALID, `Invalid ListResultPayload: "entries[${i}]" must be an object`);
|
|
9614
9715
|
}
|
|
9615
9716
|
validateStringField(entry.docId, `entries[${i}].docId`, MAX_DOC_ID_LENGTH, CONFIG_INVALID);
|
|
9616
|
-
if (!
|
|
9717
|
+
if (!isRecord3(entry.document)) {
|
|
9617
9718
|
throwInvalid(CONFIG_INVALID, `Invalid ListResultPayload: "entries[${i}].document" must be an object`);
|
|
9618
9719
|
}
|
|
9619
9720
|
if (entry.sortValues !== null) {
|
|
@@ -9627,7 +9728,7 @@ function validateListResultPayload(decoded) {
|
|
|
9627
9728
|
return decoded;
|
|
9628
9729
|
}
|
|
9629
9730
|
function validateSuggestPayload(decoded) {
|
|
9630
|
-
if (!
|
|
9731
|
+
if (!isRecord3(decoded)) {
|
|
9631
9732
|
throwInvalid(CONFIG_INVALID, "Invalid SuggestPayload: expected an object");
|
|
9632
9733
|
}
|
|
9633
9734
|
validateIndexNameField3(decoded, "SuggestPayload");
|
|
@@ -9637,7 +9738,7 @@ function validateSuggestPayload(decoded) {
|
|
|
9637
9738
|
return decoded;
|
|
9638
9739
|
}
|
|
9639
9740
|
function validateSuggestResultPayload(decoded) {
|
|
9640
|
-
if (!
|
|
9741
|
+
if (!isRecord3(decoded)) {
|
|
9641
9742
|
throwInvalid(CONFIG_INVALID, "Invalid SuggestResultPayload: expected an object");
|
|
9642
9743
|
}
|
|
9643
9744
|
if (!Array.isArray(decoded.terms)) {
|
|
@@ -9651,7 +9752,7 @@ function validateSuggestResultPayload(decoded) {
|
|
|
9651
9752
|
}
|
|
9652
9753
|
for (let i = 0; i < decoded.terms.length; i++) {
|
|
9653
9754
|
const entry = decoded.terms[i];
|
|
9654
|
-
if (!
|
|
9755
|
+
if (!isRecord3(entry)) {
|
|
9655
9756
|
throwInvalid(CONFIG_INVALID, `Invalid SuggestResultPayload: "terms[${i}]" must be an object`);
|
|
9656
9757
|
}
|
|
9657
9758
|
validateStringField(entry.term, `terms[${i}].term`, MAX_TERM_LENGTH, CONFIG_INVALID);
|
|
@@ -9668,7 +9769,7 @@ function validateSuggestResultPayload(decoded) {
|
|
|
9668
9769
|
return decoded;
|
|
9669
9770
|
}
|
|
9670
9771
|
function validatePreflightPayload(decoded) {
|
|
9671
|
-
if (!
|
|
9772
|
+
if (!isRecord3(decoded)) {
|
|
9672
9773
|
throwInvalid(CONFIG_INVALID, "Invalid PreflightPayload: expected an object");
|
|
9673
9774
|
}
|
|
9674
9775
|
validateIndexNameField3(decoded, "PreflightPayload");
|
|
@@ -9677,7 +9778,7 @@ function validatePreflightPayload(decoded) {
|
|
|
9677
9778
|
return decoded;
|
|
9678
9779
|
}
|
|
9679
9780
|
function validatePreflightResultPayload(decoded) {
|
|
9680
|
-
if (!
|
|
9781
|
+
if (!isRecord3(decoded)) {
|
|
9681
9782
|
throwInvalid(CONFIG_INVALID, "Invalid PreflightResultPayload: expected an object");
|
|
9682
9783
|
}
|
|
9683
9784
|
if (!isInteger(decoded.count) || decoded.count < 0) {
|
|
@@ -9691,7 +9792,7 @@ function validatePreflightResultPayload(decoded) {
|
|
|
9691
9792
|
|
|
9692
9793
|
// src/distribution/query/validators/search-result.ts
|
|
9693
9794
|
function validateScoredEntry(value, fieldLabel) {
|
|
9694
|
-
if (!
|
|
9795
|
+
if (!isRecord3(value)) {
|
|
9695
9796
|
throwInvalid(CONFIG_INVALID, `Invalid SearchResultPayload: "${fieldLabel}" must be an object`);
|
|
9696
9797
|
}
|
|
9697
9798
|
if (typeof value.docId !== "string") {
|
|
@@ -9737,7 +9838,7 @@ function validateScoredEntry(value, fieldLabel) {
|
|
|
9737
9838
|
}
|
|
9738
9839
|
}
|
|
9739
9840
|
function validatePartitionSearchResult(value, fieldLabel) {
|
|
9740
|
-
if (!
|
|
9841
|
+
if (!isRecord3(value)) {
|
|
9741
9842
|
throwInvalid(CONFIG_INVALID, `Invalid SearchResultPayload: "${fieldLabel}" must be an object`);
|
|
9742
9843
|
}
|
|
9743
9844
|
validatePartitionId(value.partitionId, `${fieldLabel}.partitionId`, CONFIG_INVALID);
|
|
@@ -9762,7 +9863,7 @@ function validatePartitionSearchResult(value, fieldLabel) {
|
|
|
9762
9863
|
}
|
|
9763
9864
|
}
|
|
9764
9865
|
function validateFacetBucket(value, fieldLabel) {
|
|
9765
|
-
if (!
|
|
9866
|
+
if (!isRecord3(value)) {
|
|
9766
9867
|
throwInvalid(CONFIG_INVALID, `Invalid SearchResultPayload: "${fieldLabel}" must be an object`);
|
|
9767
9868
|
}
|
|
9768
9869
|
if (typeof value.value !== "string") {
|
|
@@ -9781,7 +9882,7 @@ function validateFacetBucket(value, fieldLabel) {
|
|
|
9781
9882
|
return { value: value.value, count: value.count };
|
|
9782
9883
|
}
|
|
9783
9884
|
function validateFacets(value) {
|
|
9784
|
-
if (!
|
|
9885
|
+
if (!isRecord3(value)) {
|
|
9785
9886
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchResultPayload: "facets" must be an object or null');
|
|
9786
9887
|
}
|
|
9787
9888
|
const entries = Object.entries(value);
|
|
@@ -9812,7 +9913,7 @@ function validateFacets(value) {
|
|
|
9812
9913
|
}
|
|
9813
9914
|
}
|
|
9814
9915
|
function validateFacetErrorBounds(value) {
|
|
9815
|
-
if (!
|
|
9916
|
+
if (!isRecord3(value)) {
|
|
9816
9917
|
throwInvalid(CONFIG_INVALID, 'Invalid SearchResultPayload: "facetErrorBounds" must be an object or null');
|
|
9817
9918
|
}
|
|
9818
9919
|
const entries = Object.entries(value);
|
|
@@ -9845,7 +9946,7 @@ function validateGroupEntries(value) {
|
|
|
9845
9946
|
}
|
|
9846
9947
|
for (let i = 0; i < value.length; i++) {
|
|
9847
9948
|
const entry = value[i];
|
|
9848
|
-
if (!
|
|
9949
|
+
if (!isRecord3(entry) || !isRecord3(entry.values)) {
|
|
9849
9950
|
throwInvalid(CONFIG_INVALID, `Invalid SearchResultPayload: "groups[${i}]" must hold a values object`);
|
|
9850
9951
|
}
|
|
9851
9952
|
if (Object.keys(entry.values).length > MAX_FACET_FIELDS) {
|
|
@@ -9870,7 +9971,7 @@ function validateGroupEntries(value) {
|
|
|
9870
9971
|
}
|
|
9871
9972
|
}
|
|
9872
9973
|
function validateSearchResultPayload(decoded) {
|
|
9873
|
-
if (!
|
|
9974
|
+
if (!isRecord3(decoded)) {
|
|
9874
9975
|
throwInvalid(CONFIG_INVALID, "Invalid SearchResultPayload: expected an object");
|
|
9875
9976
|
}
|
|
9876
9977
|
if (!Array.isArray(decoded.results)) {
|
|
@@ -9908,7 +10009,7 @@ function validateIndexNameField4(value, fieldLabel) {
|
|
|
9908
10009
|
return value;
|
|
9909
10010
|
}
|
|
9910
10011
|
function validateNumericRecord(value, fieldLabel) {
|
|
9911
|
-
if (!
|
|
10012
|
+
if (!isRecord3(value)) {
|
|
9912
10013
|
throwInvalid(CONFIG_INVALID, `Invalid payload: "${fieldLabel}" must be an object`);
|
|
9913
10014
|
}
|
|
9914
10015
|
for (const [key, entry] of Object.entries(value)) {
|
|
@@ -9946,7 +10047,7 @@ function validateBoundedInteger(value, fieldLabel, max) {
|
|
|
9946
10047
|
}
|
|
9947
10048
|
function validateExpansion(value) {
|
|
9948
10049
|
if (isAbsent(value)) return;
|
|
9949
|
-
if (!
|
|
10050
|
+
if (!isRecord3(value)) {
|
|
9950
10051
|
throwInvalid(CONFIG_INVALID, 'Invalid StatsPayload: "expansion" must be an object or absent');
|
|
9951
10052
|
}
|
|
9952
10053
|
validateBoundedInteger(value.tolerance, "expansion.tolerance", MAX_TOLERANCE);
|
|
@@ -9961,7 +10062,7 @@ function validateExpansion(value) {
|
|
|
9961
10062
|
}
|
|
9962
10063
|
}
|
|
9963
10064
|
function validateStatsPayload(decoded) {
|
|
9964
|
-
if (!
|
|
10065
|
+
if (!isRecord3(decoded)) {
|
|
9965
10066
|
throwInvalid(CONFIG_INVALID, "Invalid StatsPayload: expected an object");
|
|
9966
10067
|
}
|
|
9967
10068
|
validateIndexNameField4(decoded.indexName, "indexName");
|
|
@@ -9972,7 +10073,7 @@ function validateStatsPayload(decoded) {
|
|
|
9972
10073
|
return decoded;
|
|
9973
10074
|
}
|
|
9974
10075
|
function validateStatsResultPayload(decoded) {
|
|
9975
|
-
if (!
|
|
10076
|
+
if (!isRecord3(decoded)) {
|
|
9976
10077
|
throwInvalid(CONFIG_INVALID, "Invalid StatsResultPayload: expected an object");
|
|
9977
10078
|
}
|
|
9978
10079
|
if (!isInteger(decoded.totalDocuments) || decoded.totalDocuments < 0) {
|
|
@@ -10082,6 +10183,7 @@ var QUERY_REJECTION_CODES = /* @__PURE__ */ new Set([
|
|
|
10082
10183
|
ErrorCodes.SEARCH_INVALID_CURSOR,
|
|
10083
10184
|
ErrorCodes.SEARCH_RESULT_WINDOW_EXCEEDED,
|
|
10084
10185
|
ErrorCodes.SEARCH_WORK_CAP_EXCEEDED,
|
|
10186
|
+
ErrorCodes.BM25_NOT_READY,
|
|
10085
10187
|
ErrorCodes.VECTOR_DIMENSION_MISMATCH,
|
|
10086
10188
|
ErrorCodes.CONFIG_INVALID
|
|
10087
10189
|
]);
|
|
@@ -10096,6 +10198,10 @@ function markNodeRejection(error) {
|
|
|
10096
10198
|
nodeRejections.add(error);
|
|
10097
10199
|
return error;
|
|
10098
10200
|
}
|
|
10201
|
+
function rethrowAsRefusal(error) {
|
|
10202
|
+
if (error instanceof NarsilError && QUERY_REJECTION_CODES.has(error.code)) markNodeRejection(error);
|
|
10203
|
+
throw error;
|
|
10204
|
+
}
|
|
10099
10205
|
function isNodeRejection(error) {
|
|
10100
10206
|
return error instanceof NarsilError && nodeRejections.has(error);
|
|
10101
10207
|
}
|
|
@@ -10182,6 +10288,15 @@ function queryKeyedSelector(binding) {
|
|
|
10182
10288
|
return chosen;
|
|
10183
10289
|
};
|
|
10184
10290
|
}
|
|
10291
|
+
function copyHoldersOf2(table) {
|
|
10292
|
+
const holders = /* @__PURE__ */ new Set();
|
|
10293
|
+
for (const assignment of table.assignments.values()) {
|
|
10294
|
+
if (assignment.primary !== null) holders.add(assignment.primary);
|
|
10295
|
+
for (const replica of assignment.replicas) holders.add(replica);
|
|
10296
|
+
for (const replica of assignment.removingReplicas ?? []) holders.add(replica);
|
|
10297
|
+
}
|
|
10298
|
+
return holders;
|
|
10299
|
+
}
|
|
10185
10300
|
function collectActiveCandidates(assignment) {
|
|
10186
10301
|
if (assignment.state !== "ACTIVE") {
|
|
10187
10302
|
return [];
|
|
@@ -10305,6 +10420,39 @@ function restoreVectorValues(value) {
|
|
|
10305
10420
|
return value;
|
|
10306
10421
|
}
|
|
10307
10422
|
|
|
10423
|
+
// src/distribution/query/bm25-routing.ts
|
|
10424
|
+
function withRegisteredCopies(assignment, registered) {
|
|
10425
|
+
return {
|
|
10426
|
+
...assignment,
|
|
10427
|
+
primary: assignment.primary !== null && registered.has(assignment.primary) ? assignment.primary : null,
|
|
10428
|
+
replicas: assignment.replicas.filter((replica) => registered.has(replica))
|
|
10429
|
+
};
|
|
10430
|
+
}
|
|
10431
|
+
function bm25NotReady(subject, olderNodes, indexName) {
|
|
10432
|
+
return new NarsilError(
|
|
10433
|
+
ErrorCodes.BM25_NOT_READY,
|
|
10434
|
+
`${subject} ${olderNodes.length} node(s) below specification version ${BM25_TUNING_SPEC_VERSION}, which cannot use BM25 parameters that the index or the search sets. Try again once every node registers that version`,
|
|
10435
|
+
{ indexName, nodeIds: olderNodes.sort(), minimumVersion: BM25_TUNING_SPEC_VERSION }
|
|
10436
|
+
);
|
|
10437
|
+
}
|
|
10438
|
+
function registeredNodesBelowBm25Tuning(nodes) {
|
|
10439
|
+
return nodes.filter((node) => !reachesVersion(node.version, BM25_TUNING_SPEC_VERSION)).map((node) => node.nodeId);
|
|
10440
|
+
}
|
|
10441
|
+
async function allocationForBm25Query(indexName, table, listNodes) {
|
|
10442
|
+
const nodes = await listNodes();
|
|
10443
|
+
const versions = new Map(nodes.map((node) => [node.nodeId, node.version]));
|
|
10444
|
+
const olderNodes = [...copyHoldersOf2(table)].filter(
|
|
10445
|
+
(holder) => versions.has(holder) && !reachesVersion(versions.get(holder), BM25_TUNING_SPEC_VERSION)
|
|
10446
|
+
);
|
|
10447
|
+
if (olderNodes.length > 0) throw bm25NotReady(`Index '${indexName}' has copies on`, olderNodes, indexName);
|
|
10448
|
+
const registered = new Set(versions.keys());
|
|
10449
|
+
const assignments = /* @__PURE__ */ new Map();
|
|
10450
|
+
for (const [partitionId, assignment] of table.assignments) {
|
|
10451
|
+
assignments.set(partitionId, withRegisteredCopies(assignment, registered));
|
|
10452
|
+
}
|
|
10453
|
+
return { ...table, assignments };
|
|
10454
|
+
}
|
|
10455
|
+
|
|
10308
10456
|
// src/distribution/cluster-node/allocation-wait.ts
|
|
10309
10457
|
function everyPartitionActive(table, partitionCount) {
|
|
10310
10458
|
if (table === null || table.assignments.size < partitionCount) {
|
|
@@ -10398,7 +10546,7 @@ function createNodeMemoryView(options) {
|
|
|
10398
10546
|
}
|
|
10399
10547
|
};
|
|
10400
10548
|
}
|
|
10401
|
-
function
|
|
10549
|
+
function copyHoldersOf3(table) {
|
|
10402
10550
|
const holders = /* @__PURE__ */ new Set();
|
|
10403
10551
|
for (const assignment of table.assignments.values()) {
|
|
10404
10552
|
if (assignment.primary !== null) {
|
|
@@ -10418,7 +10566,7 @@ function findWriteBlock(table, view) {
|
|
|
10418
10566
|
if (fullNodeIds.size === 0) {
|
|
10419
10567
|
return null;
|
|
10420
10568
|
}
|
|
10421
|
-
const blockingNodeIds = [...
|
|
10569
|
+
const blockingNodeIds = [...copyHoldersOf3(table)].filter((nodeId) => fullNodeIds.has(nodeId)).sort(compareCodePoints);
|
|
10422
10570
|
if (blockingNodeIds.length === 0) {
|
|
10423
10571
|
return null;
|
|
10424
10572
|
}
|
|
@@ -10784,7 +10932,7 @@ function interruptedOutcome(indexName, docId, error) {
|
|
|
10784
10932
|
}
|
|
10785
10933
|
|
|
10786
10934
|
// src/distribution/cluster-node/write-routing/sent-fields.ts
|
|
10787
|
-
function
|
|
10935
|
+
function isRecord4(value) {
|
|
10788
10936
|
return typeof value === "object" && value !== null && !Array.isArray(value) && !ArrayBuffer.isView(value);
|
|
10789
10937
|
}
|
|
10790
10938
|
function numbersOf(value) {
|
|
@@ -10817,8 +10965,8 @@ function matchesSent(sent, stored, path, derivedFields) {
|
|
|
10817
10965
|
if (!Array.isArray(stored) || sent.length !== stored.length) return false;
|
|
10818
10966
|
return sent.every((element, position) => matchesSent(element, stored[position], path, /* @__PURE__ */ new Set()));
|
|
10819
10967
|
}
|
|
10820
|
-
if (
|
|
10821
|
-
if (!
|
|
10968
|
+
if (isRecord4(sent)) {
|
|
10969
|
+
if (!isRecord4(stored)) return false;
|
|
10822
10970
|
for (const [key, value] of Object.entries(sent)) {
|
|
10823
10971
|
if (value === void 0) continue;
|
|
10824
10972
|
if (!matchesSent(value, stored[key], fieldPath(path, key), derivedFields)) return false;
|
|
@@ -11312,7 +11460,7 @@ async function assertReshardOpen(state, coordinator, indexName, partitionId, pri
|
|
|
11312
11460
|
}
|
|
11313
11461
|
if (state.blocks.has(key)) throw rebalancingBackpressure(indexName, partitionId);
|
|
11314
11462
|
}
|
|
11315
|
-
function
|
|
11463
|
+
function isRecord5(value) {
|
|
11316
11464
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
11317
11465
|
}
|
|
11318
11466
|
function requireCount(record, field, payloadName) {
|
|
@@ -11346,7 +11494,7 @@ function createTermStartAckMessage(payload, sourceId, requestId) {
|
|
|
11346
11494
|
}
|
|
11347
11495
|
function validateTermStartPayload(payload) {
|
|
11348
11496
|
const decoded = decode(payload);
|
|
11349
|
-
if (!
|
|
11497
|
+
if (!isRecord5(decoded)) {
|
|
11350
11498
|
throw new Error("Invalid TermStartPayload: expected an object");
|
|
11351
11499
|
}
|
|
11352
11500
|
const validated = {
|
|
@@ -11364,7 +11512,7 @@ function termStartAckOf(response, request) {
|
|
|
11364
11512
|
if (response.type !== ReplicationMessageTypes.TERM_START_ACK) return null;
|
|
11365
11513
|
try {
|
|
11366
11514
|
const decoded = decode(response.payload);
|
|
11367
|
-
if (!
|
|
11515
|
+
if (!isRecord5(decoded)) return null;
|
|
11368
11516
|
const answer = {
|
|
11369
11517
|
indexName: requireIndexName(decoded, "TermStartAckPayload"),
|
|
11370
11518
|
partitionId: requireCount(decoded, "partitionId", "TermStartAckPayload"),
|
|
@@ -12822,6 +12970,12 @@ async function routeCreateIndex(name, requestedConfig, options, coordinator, eng
|
|
|
12822
12970
|
const config = { ...requestedConfig, schema: validateSchema(requestedConfig.schema) };
|
|
12823
12971
|
requireCreatableSchema(config.schema);
|
|
12824
12972
|
requireSurfaceFormsForPartialFields(config.schema, config.surfaceForms);
|
|
12973
|
+
if (config.bm25 !== void 0) validateBM25Params(config.bm25, config.schema, ErrorCodes.CONFIG_INVALID);
|
|
12974
|
+
const setsFieldPairs = config.bm25?.fields !== void 0 && bm25SetsValue({ fields: config.bm25.fields });
|
|
12975
|
+
if (setsFieldPairs) {
|
|
12976
|
+
const olderNodes = registeredNodesBelowBm25Tuning(await coordinator.listNodes());
|
|
12977
|
+
if (olderNodes.length > 0) throw bm25NotReady("The cluster has", olderNodes, name);
|
|
12978
|
+
}
|
|
12825
12979
|
const partitionCount = options?.partitionCount ?? DEFAULT_PARTITION_COUNT;
|
|
12826
12980
|
const replicationFactor = options?.replicationFactor ?? DEFAULT_REPLICATION_FACTOR;
|
|
12827
12981
|
validateCreateIndexOptions(partitionCount, replicationFactor);
|
|
@@ -12841,7 +12995,11 @@ async function routeCreateIndex(name, requestedConfig, options, coordinator, eng
|
|
|
12841
12995
|
partitionCount,
|
|
12842
12996
|
replicationFactor,
|
|
12843
12997
|
constraints,
|
|
12844
|
-
settings: {
|
|
12998
|
+
settings: {
|
|
12999
|
+
...indexSettingsOf(config),
|
|
13000
|
+
...synonymSet !== null ? { synonyms: synonymSet } : {},
|
|
13001
|
+
...setsFieldPairs ? { bm25Revision: 1 } : {}
|
|
13002
|
+
}
|
|
12845
13003
|
};
|
|
12846
13004
|
const stored = await putIndexMetadata(coordinator, metadata).catch(async (err) => {
|
|
12847
13005
|
await discardSynonymSet(coordinator, indexUuid, synonymSet);
|
|
@@ -13193,7 +13351,7 @@ async function swapStoredSet(coordinator, indexName, first, ref) {
|
|
|
13193
13351
|
const replaced = current.settings?.synonyms ?? null;
|
|
13194
13352
|
const next = metadataWithSynonymSet(current, ref);
|
|
13195
13353
|
if (await coordinator.compareAndSet(indexConfigKey(indexName), current.bytes, next)) return replaced;
|
|
13196
|
-
if (attempt >=
|
|
13354
|
+
if (attempt >= MAX_SETTINGS_REPLACEMENT_ATTEMPTS) {
|
|
13197
13355
|
throw new NarsilError(
|
|
13198
13356
|
ErrorCodes.CLUSTER_WRITE_BLOCKED,
|
|
13199
13357
|
`Index '${indexName}' kept changing while its synonym set was replaced ${attempt} times over, so the new set was not stored. Retry the request`,
|
|
@@ -13328,6 +13486,15 @@ async function reconcileOne(deps, indexName) {
|
|
|
13328
13486
|
report(deps, indexName, `its synonym set could not be read: ${describeError(error)}`);
|
|
13329
13487
|
return "orphaned";
|
|
13330
13488
|
}
|
|
13489
|
+
try {
|
|
13490
|
+
const stored = await readIndexMetadataSnapshot(deps.coordinator, indexName);
|
|
13491
|
+
if (stored?.record.indexUuid === clusterUuid) {
|
|
13492
|
+
await deps.engine.applyStoredBm25(indexName, () => ({ bm25: stored.settings?.bm25 }));
|
|
13493
|
+
}
|
|
13494
|
+
} catch (error) {
|
|
13495
|
+
report(deps, indexName, `its BM25 setting could not be read: ${describeError(error)}`);
|
|
13496
|
+
return "orphaned";
|
|
13497
|
+
}
|
|
13331
13498
|
return "adopted";
|
|
13332
13499
|
}
|
|
13333
13500
|
function report(deps, indexName, reason) {
|
|
@@ -14097,6 +14264,7 @@ function wireParamsToLocal(wire, facetShardSize) {
|
|
|
14097
14264
|
fields: wire.fields ?? void 0,
|
|
14098
14265
|
filters: wire.filters ?? void 0,
|
|
14099
14266
|
boost: wire.boost ?? void 0,
|
|
14267
|
+
bm25: wire.bm25 ?? void 0,
|
|
14100
14268
|
scoring: wire.scoring,
|
|
14101
14269
|
tolerance: wire.tolerance ?? void 0,
|
|
14102
14270
|
minScore: wire.threshold ?? void 0,
|
|
@@ -14182,7 +14350,7 @@ function ascendingFacetFields(facets) {
|
|
|
14182
14350
|
return ascending;
|
|
14183
14351
|
}
|
|
14184
14352
|
function localParamsToWire(params) {
|
|
14185
|
-
|
|
14353
|
+
const wire = {
|
|
14186
14354
|
term: params.term ?? null,
|
|
14187
14355
|
filters: params.filters ?? null,
|
|
14188
14356
|
sort: convertLocalSortToWire(params.sort),
|
|
@@ -14208,6 +14376,8 @@ function localParamsToWire(params) {
|
|
|
14208
14376
|
vector: convertLocalVectorToWire(params.vector),
|
|
14209
14377
|
hybrid: convertLocalHybridToWire(params.hybrid)
|
|
14210
14378
|
};
|
|
14379
|
+
if (params.bm25 !== void 0 && bm25SetsValue(params.bm25)) wire.bm25 = params.bm25;
|
|
14380
|
+
return wire;
|
|
14211
14381
|
}
|
|
14212
14382
|
function countIsExactFor(params) {
|
|
14213
14383
|
const vector = params.vector;
|
|
@@ -14426,7 +14596,8 @@ async function handleSearch(message, respond, deps) {
|
|
|
14426
14596
|
payload.partitionIds,
|
|
14427
14597
|
payload.globalStats ?? void 0,
|
|
14428
14598
|
rescoreWindow,
|
|
14429
|
-
snapshots
|
|
14599
|
+
snapshots,
|
|
14600
|
+
payload.params.indexBm25 ?? void 0
|
|
14430
14601
|
);
|
|
14431
14602
|
const rankedDocument = (hit) => snapshots?.get(hit.id)?.fields ?? hit.document;
|
|
14432
14603
|
const normalizedSort = queryParams.sort !== void 0 ? normalizeSort(queryParams.sort) : null;
|
|
@@ -14640,7 +14811,12 @@ async function handleSuggest(message, respond, deps) {
|
|
|
14640
14811
|
async function handlePreflight(message, respond, deps) {
|
|
14641
14812
|
const payload = validatePreflightPayload(decode(message.payload));
|
|
14642
14813
|
const params = wireParamsToLocal(payload.params);
|
|
14643
|
-
const result = await deps.engine.preflightPartitions(
|
|
14814
|
+
const result = await deps.engine.preflightPartitions(
|
|
14815
|
+
payload.indexName,
|
|
14816
|
+
params,
|
|
14817
|
+
payload.partitionIds,
|
|
14818
|
+
payload.params.indexBm25 ?? void 0
|
|
14819
|
+
);
|
|
14644
14820
|
await respond(
|
|
14645
14821
|
createPreflightResultMessage(
|
|
14646
14822
|
{ count: result.count, analysisStale: result.analysisStale === true },
|
|
@@ -15572,6 +15748,38 @@ async function resolveNodeId(explicitNodeId, directory) {
|
|
|
15572
15748
|
}
|
|
15573
15749
|
}
|
|
15574
15750
|
|
|
15751
|
+
// src/distribution/cluster-node/bm25-change.ts
|
|
15752
|
+
var SETTINGS_CONTENTION_REASON2 = "settings_contention";
|
|
15753
|
+
function indexNotFound2(indexName) {
|
|
15754
|
+
return new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index '${indexName}' does not exist in the cluster`, {
|
|
15755
|
+
indexName
|
|
15756
|
+
});
|
|
15757
|
+
}
|
|
15758
|
+
async function replaceClusterBm25(coordinator, view, indexName, value) {
|
|
15759
|
+
validateIndexName(indexName);
|
|
15760
|
+
const schema = await coordinator.getSchema(indexName);
|
|
15761
|
+
if (schema === null) throw indexNotFound2(indexName);
|
|
15762
|
+
validateBM25Params(value, schema, ErrorCodes.CONFIG_INVALID);
|
|
15763
|
+
const bm25 = storedBM25Params(value);
|
|
15764
|
+
const olderNodes = registeredNodesBelowBm25Tuning(await coordinator.listNodes());
|
|
15765
|
+
if (olderNodes.length > 0) throw bm25NotReady("The cluster has", olderNodes, indexName);
|
|
15766
|
+
for (let attempt = 1; attempt <= MAX_SETTINGS_REPLACEMENT_ATTEMPTS; attempt++) {
|
|
15767
|
+
const current = await readIndexMetadataSnapshot(coordinator, indexName);
|
|
15768
|
+
if (current === null) throw indexNotFound2(indexName);
|
|
15769
|
+
const revision = (current.settings?.bm25Revision ?? 0) + 1;
|
|
15770
|
+
const next = metadataWithBm25(current, bm25, revision);
|
|
15771
|
+
if (await coordinator.compareAndSet(indexConfigKey(indexName), current.bytes, next)) {
|
|
15772
|
+
await view.applyWritten(indexName, { indexUuid: current.record.indexUuid, bm25, revision });
|
|
15773
|
+
return;
|
|
15774
|
+
}
|
|
15775
|
+
}
|
|
15776
|
+
throw new NarsilError(
|
|
15777
|
+
ErrorCodes.CLUSTER_WRITE_BLOCKED,
|
|
15778
|
+
`Index '${indexName}' kept changing while its BM25 setting was replaced ${MAX_SETTINGS_REPLACEMENT_ATTEMPTS} times over, so the new setting was not stored. Retry the request`,
|
|
15779
|
+
{ reason: SETTINGS_CONTENTION_REASON2, indexName, attempts: MAX_SETTINGS_REPLACEMENT_ATTEMPTS }
|
|
15780
|
+
);
|
|
15781
|
+
}
|
|
15782
|
+
|
|
15575
15783
|
// src/distribution/query/node-send.ts
|
|
15576
15784
|
async function resolveTargets(nodeId, deps) {
|
|
15577
15785
|
if (deps.resolveNodeTargets === void 0) {
|
|
@@ -16331,7 +16539,8 @@ async function distributedQuery(indexName, params, deps, config, selector) {
|
|
|
16331
16539
|
coverage: { totalPartitions: 0, queriedPartitions: 0, timedOutPartitions: 0, failedPartitions: 0 }
|
|
16332
16540
|
};
|
|
16333
16541
|
}
|
|
16334
|
-
const
|
|
16542
|
+
const routedTable = deps.listNodes !== void 0 && deps.carriesBm25 === true ? await allocationForBm25Query(indexName, allocationTable, deps.listNodes) : allocationTable;
|
|
16543
|
+
const routing = selectReplicasForQuery(routedTable, queryKeyedSelector(binding));
|
|
16335
16544
|
const totalPartitions = allocationTable.assignments.size;
|
|
16336
16545
|
if (routing.unavailablePartitions.length > 0 && !resolvedConfig.allowPartialResults) {
|
|
16337
16546
|
throw new NarsilError(
|
|
@@ -16492,6 +16701,27 @@ function failOutcomesMissingSortValues(outcomes) {
|
|
|
16492
16701
|
}
|
|
16493
16702
|
}
|
|
16494
16703
|
|
|
16704
|
+
// src/distribution/cluster-node/reads/bm25.ts
|
|
16705
|
+
function routingUnder(params, setting) {
|
|
16706
|
+
const wireParams = localParamsToWire(params);
|
|
16707
|
+
if (setting === null) return { wireParams, indexBm25: void 0, carriesBm25: bm25SetsValue(params.bm25) };
|
|
16708
|
+
const indexBm25 = setting.bm25 ?? {};
|
|
16709
|
+
wireParams.indexBm25 = indexBm25;
|
|
16710
|
+
return { wireParams, indexBm25, carriesBm25: setting.revision !== void 0 || bm25SetsValue(params.bm25) };
|
|
16711
|
+
}
|
|
16712
|
+
function heldBm25RoutingFor(deps, settingName, params) {
|
|
16713
|
+
if (params.bm25 !== void 0) return void 0;
|
|
16714
|
+
const setting = deps.bm25View.held(settingName);
|
|
16715
|
+
return setting === void 0 ? void 0 : routingUnder(params, setting);
|
|
16716
|
+
}
|
|
16717
|
+
async function bm25RoutingFor(deps, settingName, params) {
|
|
16718
|
+
if (params.bm25 !== void 0) {
|
|
16719
|
+
const schema = await deps.config.coordinator.getSchema(settingName);
|
|
16720
|
+
if (schema !== null) validateBM25Params(params.bm25, schema, ErrorCodes.SEARCH_INVALID_FIELD);
|
|
16721
|
+
}
|
|
16722
|
+
return routingUnder(params, await deps.bm25View.current(settingName));
|
|
16723
|
+
}
|
|
16724
|
+
|
|
16495
16725
|
// src/distribution/cluster-node/reads/groups.ts
|
|
16496
16726
|
async function assembleDistributedGroups(params, distributed, projection, readDocuments) {
|
|
16497
16727
|
const wireGroups = distributed.groups;
|
|
@@ -17050,16 +17280,18 @@ async function suggestCluster(deps, indexName, params) {
|
|
|
17050
17280
|
}
|
|
17051
17281
|
return result;
|
|
17052
17282
|
}
|
|
17053
|
-
async function preflightCluster(deps, indexName, params) {
|
|
17283
|
+
async function preflightCluster(deps, indexName, params, settingName) {
|
|
17054
17284
|
const allocation = await routableAllocation(deps.config.coordinator, indexName);
|
|
17055
17285
|
if (allocation === null) {
|
|
17056
17286
|
return deps.engine.preflight(indexName, params);
|
|
17057
17287
|
}
|
|
17058
17288
|
const startTime = performance.now();
|
|
17059
|
-
const wireParams =
|
|
17060
|
-
const
|
|
17289
|
+
const { wireParams, indexBm25, carriesBm25 } = await bm25RoutingFor(deps, settingName, params);
|
|
17290
|
+
const coordinator = deps.config.coordinator;
|
|
17291
|
+
const routedAllocation = carriesBm25 ? await allocationForBm25Query(indexName, allocation, () => coordinator.listNodes()) : allocation;
|
|
17292
|
+
const gathered = await gatherFromEveryPartition(routedAllocation, indexName, async (group) => {
|
|
17061
17293
|
if (group.nodeId === deps.nodeId) {
|
|
17062
|
-
const local = await deps.engine.preflightPartitions(indexName, params, group.partitionIds);
|
|
17294
|
+
const local = await deps.engine.preflightPartitions(indexName, params, group.partitionIds, indexBm25).catch(rethrowAsRefusal);
|
|
17063
17295
|
return { count: local.count, analysisStale: local.analysisStale === true };
|
|
17064
17296
|
}
|
|
17065
17297
|
const message = createPreflightMessage(
|
|
@@ -17130,7 +17362,7 @@ async function withRankedReader(deps, indexName, allocation, run) {
|
|
|
17130
17362
|
reader.release();
|
|
17131
17363
|
}
|
|
17132
17364
|
}
|
|
17133
|
-
async function queryCluster(deps, indexName, params) {
|
|
17365
|
+
async function queryCluster(deps, indexName, params, settingName) {
|
|
17134
17366
|
const allocation = await routableAllocation(deps.config.coordinator, indexName);
|
|
17135
17367
|
if (allocation === null) {
|
|
17136
17368
|
return deps.engine.query(indexName, params);
|
|
@@ -17141,10 +17373,10 @@ async function queryCluster(deps, indexName, params) {
|
|
|
17141
17373
|
deps,
|
|
17142
17374
|
indexName,
|
|
17143
17375
|
allocation,
|
|
17144
|
-
(reader) => searchCluster(deps, indexName, params, allocation, reader, false)
|
|
17376
|
+
(reader) => searchCluster(deps, indexName, settingName, params, allocation, reader, false)
|
|
17145
17377
|
);
|
|
17146
17378
|
}
|
|
17147
|
-
const { rerankClusterQuery } = await import('./rerank-
|
|
17379
|
+
const { rerankClusterQuery } = await import('./rerank-V4J4MIWR.mjs');
|
|
17148
17380
|
return withRankedReader(
|
|
17149
17381
|
deps,
|
|
17150
17382
|
indexName,
|
|
@@ -17153,23 +17385,25 @@ async function queryCluster(deps, indexName, params) {
|
|
|
17153
17385
|
deps,
|
|
17154
17386
|
indexName,
|
|
17155
17387
|
params,
|
|
17156
|
-
(firstStage) => searchCluster(deps, indexName, firstStage, allocation, reader, true),
|
|
17388
|
+
(firstStage) => searchCluster(deps, indexName, settingName, firstStage, allocation, reader, true),
|
|
17157
17389
|
(docIds, last) => reader.read(docIds, { last, fields: null, requireEveryPartition: true }),
|
|
17158
17390
|
clusterRerankHost
|
|
17159
17391
|
)
|
|
17160
17392
|
);
|
|
17161
17393
|
});
|
|
17162
17394
|
}
|
|
17163
|
-
async function searchCluster(deps, indexName, params, allocation, reader, readsLater) {
|
|
17395
|
+
async function searchCluster(deps, indexName, settingName, params, allocation, reader, readsLater) {
|
|
17164
17396
|
const projection = resolveProjection(params.document);
|
|
17165
17397
|
const groupsRead = params.group !== void 0 && (params.group.reduce !== void 0 || projection.kind !== "none");
|
|
17166
17398
|
const readsDocuments = readsLater || projection.kind !== "none" || groupsRead;
|
|
17167
|
-
const wireParams =
|
|
17399
|
+
const { wireParams, carriesBm25 } = heldBm25RoutingFor(deps, settingName, params) ?? await bm25RoutingFor(deps, settingName, params);
|
|
17168
17400
|
const queryDeps = {
|
|
17169
17401
|
transport: deps.config.transport,
|
|
17170
17402
|
sourceNodeId: deps.nodeId,
|
|
17171
17403
|
getAllocation: (idx) => deps.config.coordinator.getAllocation(idx),
|
|
17172
|
-
resolveNodeTargets: deps.resolveNodeTargets
|
|
17404
|
+
resolveNodeTargets: deps.resolveNodeTargets,
|
|
17405
|
+
listNodes: () => deps.config.coordinator.listNodes(),
|
|
17406
|
+
carriesBm25
|
|
17173
17407
|
};
|
|
17174
17408
|
const distributed = await distributedQuery(
|
|
17175
17409
|
indexName,
|
|
@@ -17390,6 +17624,10 @@ function createClusterNodeOperations(deps) {
|
|
|
17390
17624
|
async getSynonyms(indexName) {
|
|
17391
17625
|
return trackOp(indexName, () => readClusterSynonyms(coordinator, indexName));
|
|
17392
17626
|
},
|
|
17627
|
+
async updateBM25(indexName, bm25) {
|
|
17628
|
+
refuseHiddenGeneration(indexName);
|
|
17629
|
+
return trackOp(indexName, () => replaceClusterBm25(coordinator, readDeps.bm25View, indexName, bm25));
|
|
17630
|
+
},
|
|
17393
17631
|
async clear(indexName) {
|
|
17394
17632
|
return served(indexName, (name) => clearCluster(readDeps, writeDeps, name));
|
|
17395
17633
|
},
|
|
@@ -17403,7 +17641,7 @@ function createClusterNodeOperations(deps) {
|
|
|
17403
17641
|
return served(indexName, (name) => suggestCluster(readDeps, name, params));
|
|
17404
17642
|
},
|
|
17405
17643
|
async preflight(indexName, params) {
|
|
17406
|
-
return served(indexName, (name) => preflightCluster(readDeps, name, params));
|
|
17644
|
+
return served(indexName, (name) => preflightCluster(readDeps, name, params, indexName));
|
|
17407
17645
|
},
|
|
17408
17646
|
async rebuildAnalysis(indexName) {
|
|
17409
17647
|
return served(
|
|
@@ -17437,7 +17675,7 @@ function createClusterNodeOperations(deps) {
|
|
|
17437
17675
|
engine.off(event, handler);
|
|
17438
17676
|
},
|
|
17439
17677
|
async query(indexName, params) {
|
|
17440
|
-
return served(indexName, (name) => queryCluster(readDeps, name, params));
|
|
17678
|
+
return served(indexName, (name) => queryCluster(readDeps, name, params, indexName));
|
|
17441
17679
|
},
|
|
17442
17680
|
async get(indexName, docId) {
|
|
17443
17681
|
return served(indexName, async (name) => (await readClusterDocuments(readDeps, name, [docId])).get(docId));
|
|
@@ -18623,7 +18861,8 @@ async function createClusterNode(callerConfig) {
|
|
|
18623
18861
|
});
|
|
18624
18862
|
const trackOp = operationTracker.track;
|
|
18625
18863
|
const transitionIndex = operationTracker.transition;
|
|
18626
|
-
const
|
|
18864
|
+
const bm25View = createBm25View({ coordinator: config.coordinator, engine, onError: forwardOnError });
|
|
18865
|
+
const readDeps = { config: routingConfig2, nodeId, engine, resolveNodeTargets: resolveNodeTargets3, searchContexts, bm25View };
|
|
18627
18866
|
const servingName = (indexName) => servingNameOf(allocationView.routing, indexName);
|
|
18628
18867
|
const cluster = createClusterNamespace({
|
|
18629
18868
|
nodeId,
|
|
@@ -18675,6 +18914,7 @@ async function createClusterNode(callerConfig) {
|
|
|
18675
18914
|
async start() {
|
|
18676
18915
|
guardShutdown();
|
|
18677
18916
|
await allocationView.start();
|
|
18917
|
+
await bm25View.start();
|
|
18678
18918
|
const dispositions = await reconcileLocalIndexes({
|
|
18679
18919
|
engine,
|
|
18680
18920
|
coordinator: config.coordinator,
|
|
@@ -18733,6 +18973,7 @@ async function createClusterNode(callerConfig) {
|
|
|
18733
18973
|
serving = false;
|
|
18734
18974
|
await operationTracker.drain();
|
|
18735
18975
|
allocationView.stop();
|
|
18976
|
+
bm25View.stop();
|
|
18736
18977
|
if (unregisterHandler !== null) {
|
|
18737
18978
|
unregisterHandler();
|
|
18738
18979
|
unregisterHandler = null;
|
|
@@ -18814,6 +19055,9 @@ function clusterNodeEngine(node, options) {
|
|
|
18814
19055
|
async updateSynonyms(indexName, synonyms) {
|
|
18815
19056
|
return node.updateSynonyms(indexName, synonyms);
|
|
18816
19057
|
},
|
|
19058
|
+
async updateBM25(indexName, bm25) {
|
|
19059
|
+
return node.updateBM25(indexName, bm25);
|
|
19060
|
+
},
|
|
18817
19061
|
async getSynonyms(indexName) {
|
|
18818
19062
|
return node.getSynonyms(indexName);
|
|
18819
19063
|
},
|