@delali/narsil 0.3.1-next.113 → 0.3.1-next.116
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/browser/{chunk-DC2SZO4D.mjs → chunk-2TMWIATH.mjs} +107 -67
- package/dist/browser/{chunk-YZPOBLAS.mjs → chunk-73U5DWOZ.mjs} +4 -3
- package/dist/browser/{chunk-4FVSBSXY.mjs → chunk-FODCC3MK.mjs} +1 -1
- package/dist/browser/{chunk-3YPLBK4C.mjs → chunk-I45FAGOF.mjs} +2 -2
- package/dist/browser/{durability-wiring-2RG22WQJ.mjs → durability-wiring-CSMTKEYX.mjs} +3 -3
- package/dist/browser/{module-5EWHBKHZ.mjs → module-G2PPZV3B.mjs} +27 -24
- package/dist/browser/{restore-queue-WCFUB4NS.mjs → restore-queue-N7N42PBS.mjs} +1 -1
- package/dist/browser/{runtime-FL5K4JOH.mjs → runtime-BX6XRFYR.mjs} +2 -2
- package/dist/browser/{snapshot-BE3F2PNC.mjs → snapshot-EBH6RXQO.mjs} +4 -4
- package/dist/browser/{write-MV7K7OCU.mjs → write-5ZKFINX3.mjs} +2 -2
- package/dist/{chunk-H2GNWBLB.mjs → chunk-4ZKBKPBV.mjs} +1 -1
- package/dist/{chunk-GLZI636G.mjs → chunk-5VVSHCXT.mjs} +27 -12
- package/dist/{chunk-LVNBY2TS.mjs → chunk-7EWQZQDT.mjs} +1 -1
- package/dist/{chunk-4PFOOQFQ.mjs → chunk-BCNUJVTT.mjs} +1 -1
- package/dist/{chunk-PABYSTKO.mjs → chunk-BCSWODXP.mjs} +71 -54
- package/dist/{thread-S4SUCV4Y.mjs → chunk-DEXID4ZT.mjs} +300 -202
- package/dist/{chunk-4XWIW3F3.mjs → chunk-HC5NURS6.mjs} +4 -3
- package/dist/{chunk-AOLD3LPV.mjs → chunk-IE43SRL3.mjs} +4 -1
- package/dist/{chunk-27ZEY73B.mjs → chunk-KGVC6KJ3.mjs} +4 -4
- package/dist/{chunk-QGVMEMCG.mjs → chunk-KVLX65KD.mjs} +4 -4
- package/dist/{chunk-5WEBVYOA.mjs → chunk-N53HN5VA.mjs} +16 -9
- package/dist/chunk-N6J6EJW3.mjs +198 -0
- package/dist/{chunk-CU4OB64V.mjs → chunk-NX7KU77V.mjs} +1 -1
- package/dist/{chunk-QIFOXLWF.mjs → chunk-OGFSUXYY.mjs} +2 -2
- package/dist/{chunk-5QIRLJH4.mjs → chunk-Q62NDKEC.mjs} +4 -3
- package/dist/{chunk-DZXGNLK5.mjs → chunk-UDZYIWDP.mjs} +3 -3
- package/dist/{chunk-HNAP2KTG.mjs → chunk-VFAXPDBH.mjs} +1 -0
- package/dist/{chunk-OM5G2J6X.mjs → chunk-VOKEYJHU.mjs} +1 -1
- package/dist/{chunk-OABTAUCW.mjs → chunk-YCFQ5754.mjs} +1 -1
- package/dist/{chunk-JUAFWJON.mjs → chunk-YCSRB3IN.mjs} +3 -3
- package/dist/{chunk-CQUMNIIG.mjs → chunk-Z4DZ4KK2.mjs} +1 -0
- package/dist/{chunk-2RAQKITH.mjs → chunk-ZR63OGT2.mjs} +1 -1
- package/dist/{direct-executor-R4HOSVPE.mjs → direct-executor-OUY4RPTU.mjs} +4 -4
- package/dist/distribution.mjs +17 -17
- package/dist/{durability-wiring-XZI6355I.mjs → durability-wiring-5V6DVHFK.mjs} +13 -13
- package/dist/index.browser.mjs +1 -1
- package/dist/index.mjs +7 -7
- package/dist/long-query-thread-HMQM2FWL.mjs +118 -0
- package/dist/{module-WVKSJL74.mjs → module-3IMTXNPW.mjs} +30 -27
- package/dist/pattern.mjs +1 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +10 -10
- package/dist/{rerank-3POMPQNX.mjs → rerank-NYX5S7OG.mjs} +3 -3
- package/dist/{restore-queue-JAZAB5IQ.mjs → restore-queue-J6PCG4ON.mjs} +1 -1
- package/dist/{runtime-C2435MPK.mjs → runtime-XNYW6AWX.mjs} +2 -2
- package/dist/server.mjs +93 -199
- package/dist/{snapshot-PDUGHQ25.mjs → snapshot-57WF53MK.mjs} +14 -14
- package/dist/thread-FDEHU5G3.mjs +31 -0
- package/dist/vector/search-worker.mjs +2 -2
- package/dist/workers/entry.mjs +17 -5
- package/dist/{write-KVJ7YJJ6.mjs → write-YEI7A5OR.mjs} +8 -8
- package/package.json +7 -7
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig,
|
|
1
|
+
import { validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, lazyQueryBinding, executeQuery, executePreflight, executeSuggest, executeListDocuments, validateDocId } from './chunk-5VVSHCXT.mjs';
|
|
2
2
|
import { resolveVectorText, bindEngineCore, restoredConfigFields, restoredEmbedding, collectRequiredFieldFailures, embedChunkDocuments, providedDocId, requireDocumentObject, admitInsert, asBatchInsertError, requireMatchingDocId, embedDocumentFields, assertDocumentCarriesMappedVectors, admitBufferedUpsert, createPendingAdmissions, recordPendingAdmission } from './chunk-N57XXGPG.mjs';
|
|
3
3
|
import { splitWorkerBudget, resolveWorkerCount, resolveWorkerEntry, missingWorkerEntry, DEFAULT_REQUEST_TIMEOUT_MS, resolveRequestThreadCount, workerResourceLimits, DEFAULT_BACKPRESSURE_LIMIT, SHUTDOWN_TIMEOUT_MS, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH } from './chunk-6PN3U6XW.mjs';
|
|
4
4
|
import { detectRuntime } from './chunk-AV4IJKD2.mjs';
|
|
5
|
-
import { isEmptySynonymSet, synonymModule, createDirectExecutor, createPartitionRouter, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, resolvePartitionInsertOptions, createFrozenSegment } from './chunk-
|
|
6
|
-
import { requirePatternSearchFor, requirePartialWordSearchFor, collectQueryTermStats, mergePartitionStats, createPartitionIndex, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, fnv1a, encodeSegmentState } from './chunk-
|
|
5
|
+
import { isEmptySynonymSet, synonymModule, createDirectExecutor, createPartitionRouter, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, resolvePartitionInsertOptions, createFrozenSegment } from './chunk-Q62NDKEC.mjs';
|
|
6
|
+
import { requirePatternSearchFor, requirePartialWordSearchFor, collectQueryTermStats, mergePartitionStats, createPartitionIndex, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, fnv1a, encodeSegmentState } from './chunk-N53HN5VA.mjs';
|
|
7
7
|
import { generateId, getLanguage } from './chunk-FUUP45IS.mjs';
|
|
8
8
|
import { readHeapStatistics } from './chunk-ZATRDAYU.mjs';
|
|
9
9
|
import { countEngineThread } from './chunk-EBIHRL7B.mjs';
|
|
10
10
|
import { DEFAULT_MAX_RERANK_WINDOW, DEFAULT_RERANK_TIMEOUT_MS } from './chunk-HJSN7UYG.mjs';
|
|
11
11
|
import { MAX_INDEX_CONFIGURATION_BYTES, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, HEAP_PRESSURE_WARNING_FRACTION, FOREIGN_STATS_TTL_MS, MAX_IMPORT_REFUSALS_REPORTED, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, BATCH_CHUNK_SIZE } from './chunk-LXWDQLTW.mjs';
|
|
12
12
|
import { requireSearchBackendSettings } from './chunk-VK45J47R.mjs';
|
|
13
|
-
import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES } from './chunk-
|
|
13
|
+
import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES } from './chunk-VFAXPDBH.mjs';
|
|
14
14
|
import { getNestedValue } from './chunk-KCQG2PJT.mjs';
|
|
15
15
|
import { flattenSchema, raiseEarlierReleaseGraphSetting, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, extractVectorFieldsFromSchema, schemaFieldsOf, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-DG62H7OD.mjs';
|
|
16
16
|
import { NATIVE_CRC32_MIN_BYTES, MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-U476IXKQ.mjs';
|
|
17
17
|
import { isSingleStringFieldType } from './chunk-6ODIY6ZB.mjs';
|
|
18
18
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
19
|
-
import { createRequestId, isValidWorkerResponse } from './chunk-
|
|
20
|
-
import { loadVectorCodeFor, requireLoadedVectorCode } from './chunk-
|
|
19
|
+
import { createRequestId, isValidWorkerResponse } from './chunk-Z4DZ4KK2.mjs';
|
|
20
|
+
import { loadVectorCodeFor, requireLoadedVectorCode } from './chunk-BCNUJVTT.mjs';
|
|
21
21
|
import { noteThreadSlotLive, threadSlotOfWorker, noteThreadSlotGone } from './chunk-RFBLQLLZ.mjs';
|
|
22
22
|
import { MAX_DOCUMENT_NESTING_DEPTH } from './chunk-L5ORED7V.mjs';
|
|
23
23
|
import { ErrorCodes, NarsilError } from './chunk-OBWUWZRA.mjs';
|
|
@@ -1893,6 +1893,7 @@ var MAX_PENDING_REPLICATION_DOCUMENTS = 2e4;
|
|
|
1893
1893
|
var REPLICATION_WINDOW = 32;
|
|
1894
1894
|
var LOAD_BUFFER_YIELD_INTERVAL = 1e3;
|
|
1895
1895
|
var MAIN_COPY_LONE_QUERY_DOCUMENTS = 5e4;
|
|
1896
|
+
var LONG_QUERY_THREADS = 1;
|
|
1896
1897
|
var POOL_RESTART_DELAY_MS = 1e3;
|
|
1897
1898
|
var POOL_RESTART_DELAY_MAX_MS = 6e4;
|
|
1898
1899
|
var RETIRED_THREADS_EXIT_WAIT_MS = 1e4;
|
|
@@ -2775,15 +2776,41 @@ async function createWorkerFactory(entryPoint) {
|
|
|
2775
2776
|
throw new NarsilError(ErrorCodes.WORKER_CRASHED, `No worker support available on runtime "${runtime.runtime}"`);
|
|
2776
2777
|
}
|
|
2777
2778
|
|
|
2778
|
-
// src/workers/pool.ts
|
|
2779
|
+
// src/workers/pool-memory.ts
|
|
2779
2780
|
function toFinite(value) {
|
|
2780
2781
|
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
2781
2782
|
}
|
|
2782
2783
|
function toHeapLimit(value) {
|
|
2783
2784
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
|
|
2784
2785
|
}
|
|
2786
|
+
async function memoryStatsOf(slots) {
|
|
2787
|
+
const indices = [];
|
|
2788
|
+
const pending = [];
|
|
2789
|
+
for (const [slotIndex, slot] of slots) {
|
|
2790
|
+
indices.push(slotIndex);
|
|
2791
|
+
pending.push(
|
|
2792
|
+
slot.executor.execute({ type: "memoryReport", requestId: createRequestId() }).catch(() => null)
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2795
|
+
const reports = await Promise.all(pending);
|
|
2796
|
+
const stats = [];
|
|
2797
|
+
for (let n = 0; n < indices.length; n++) {
|
|
2798
|
+
const report = reports[n];
|
|
2799
|
+
stats.push({
|
|
2800
|
+
workerId: indices[n],
|
|
2801
|
+
heapUsed: toFinite(report?.heapUsed),
|
|
2802
|
+
heapTotal: toFinite(report?.heapTotal),
|
|
2803
|
+
heapLimit: toHeapLimit(report?.heapLimit),
|
|
2804
|
+
external: toFinite(report?.external)
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
return stats;
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
// src/workers/pool.ts
|
|
2785
2811
|
function createWorkerPool(config) {
|
|
2786
2812
|
const workerCount = resolveWorkerCount(config.count);
|
|
2813
|
+
const queryWorkerCount = workerCount - Math.min(config.longQueryWorkers ?? 0, workerCount - 1);
|
|
2787
2814
|
const workers = /* @__PURE__ */ new Map();
|
|
2788
2815
|
const deadSlots = /* @__PURE__ */ new Set();
|
|
2789
2816
|
const goneSlots = /* @__PURE__ */ new Set();
|
|
@@ -2878,10 +2905,13 @@ function createWorkerPool(config) {
|
|
|
2878
2905
|
}
|
|
2879
2906
|
};
|
|
2880
2907
|
}
|
|
2908
|
+
function isLongQueryWorker(workerId) {
|
|
2909
|
+
return workerId >= queryWorkerCount;
|
|
2910
|
+
}
|
|
2881
2911
|
function assignSlot(indexName) {
|
|
2882
|
-
const preferred = fnv1a(indexName) %
|
|
2883
|
-
for (let probe = 0; probe <
|
|
2884
|
-
const candidate2 = (preferred + probe) %
|
|
2912
|
+
const preferred = fnv1a(indexName) % queryWorkerCount;
|
|
2913
|
+
for (let probe = 0; probe < queryWorkerCount; probe++) {
|
|
2914
|
+
const candidate2 = (preferred + probe) % queryWorkerCount;
|
|
2885
2915
|
if (!deadSlots.has(candidate2)) {
|
|
2886
2916
|
return candidate2;
|
|
2887
2917
|
}
|
|
@@ -2926,29 +2956,6 @@ function createWorkerPool(config) {
|
|
|
2926
2956
|
}
|
|
2927
2957
|
throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Every worker holding index "${indexName}" has crashed`);
|
|
2928
2958
|
}
|
|
2929
|
-
async function getMemoryStats() {
|
|
2930
|
-
const indices = [];
|
|
2931
|
-
const pending = [];
|
|
2932
|
-
for (const [slotIndex, slot] of workers) {
|
|
2933
|
-
indices.push(slotIndex);
|
|
2934
|
-
pending.push(
|
|
2935
|
-
slot.executor.execute({ type: "memoryReport", requestId: createRequestId() }).catch(() => null)
|
|
2936
|
-
);
|
|
2937
|
-
}
|
|
2938
|
-
const reports = await Promise.all(pending);
|
|
2939
|
-
const stats = [];
|
|
2940
|
-
for (let n = 0; n < indices.length; n++) {
|
|
2941
|
-
const report = reports[n];
|
|
2942
|
-
stats.push({
|
|
2943
|
-
workerId: indices[n],
|
|
2944
|
-
heapUsed: toFinite(report?.heapUsed),
|
|
2945
|
-
heapTotal: toFinite(report?.heapTotal),
|
|
2946
|
-
heapLimit: toHeapLimit(report?.heapLimit),
|
|
2947
|
-
external: toFinite(report?.external)
|
|
2948
|
-
});
|
|
2949
|
-
}
|
|
2950
|
-
return stats;
|
|
2951
|
-
}
|
|
2952
2959
|
async function shutdown() {
|
|
2953
2960
|
if (isShutdown) {
|
|
2954
2961
|
return;
|
|
@@ -2996,7 +3003,7 @@ function createWorkerPool(config) {
|
|
|
2996
3003
|
let chosenId = -1;
|
|
2997
3004
|
let chosen = null;
|
|
2998
3005
|
for (const [workerId, slot] of workers) {
|
|
2999
|
-
if (!slot.serving) continue;
|
|
3006
|
+
if (!slot.serving || isLongQueryWorker(workerId)) continue;
|
|
3000
3007
|
if (indexName !== void 0 && !slot.indexes.has(indexName)) continue;
|
|
3001
3008
|
if (chosen === null || slot.inFlight < chosen.inFlight) {
|
|
3002
3009
|
chosenId = workerId;
|
|
@@ -3008,8 +3015,8 @@ function createWorkerPool(config) {
|
|
|
3008
3015
|
}
|
|
3009
3016
|
function queriesInFlight() {
|
|
3010
3017
|
let total = 0;
|
|
3011
|
-
for (const slot of workers
|
|
3012
|
-
if (slot.serving) total += slot.inFlight;
|
|
3018
|
+
for (const [workerId, slot] of workers) {
|
|
3019
|
+
if (slot.serving && !isLongQueryWorker(workerId)) total += slot.inFlight;
|
|
3013
3020
|
}
|
|
3014
3021
|
return total;
|
|
3015
3022
|
}
|
|
@@ -3017,7 +3024,7 @@ function createWorkerPool(config) {
|
|
|
3017
3024
|
const leases = [];
|
|
3018
3025
|
for (const [workerId, slot] of workers) {
|
|
3019
3026
|
if (leases.length >= limit) break;
|
|
3020
|
-
if (slot.serving && slot.inFlight === 0) leases.push(lease(workerId, slot));
|
|
3027
|
+
if (slot.serving && slot.inFlight === 0 && !isLongQueryWorker(workerId)) leases.push(lease(workerId, slot));
|
|
3021
3028
|
}
|
|
3022
3029
|
return leases;
|
|
3023
3030
|
}
|
|
@@ -3043,6 +3050,7 @@ function createWorkerPool(config) {
|
|
|
3043
3050
|
executorsHolding,
|
|
3044
3051
|
leaseLeastBusy,
|
|
3045
3052
|
leaseIdle,
|
|
3053
|
+
isLongQueryWorker,
|
|
3046
3054
|
queriesInFlight,
|
|
3047
3055
|
spawnAll,
|
|
3048
3056
|
deadWorkerIds,
|
|
@@ -3053,7 +3061,7 @@ function createWorkerPool(config) {
|
|
|
3053
3061
|
addIndex,
|
|
3054
3062
|
addIndexToAll,
|
|
3055
3063
|
removeIndex,
|
|
3056
|
-
getMemoryStats,
|
|
3064
|
+
getMemoryStats: () => memoryStatsOf(workers.entries()),
|
|
3057
3065
|
shutdown,
|
|
3058
3066
|
whenEveryThreadIsGone
|
|
3059
3067
|
};
|
|
@@ -3083,7 +3091,7 @@ async function insertOnLease(lease, indexName, fieldName, handle, ordinals) {
|
|
|
3083
3091
|
function sharedCopyHostOf(state) {
|
|
3084
3092
|
return {
|
|
3085
3093
|
get workerCount() {
|
|
3086
|
-
return state.workerPool?.workerCount ?? state.keywordWorkerCount;
|
|
3094
|
+
return state.workerPool?.workerCount ?? state.keywordWorkerCount + state.longQueryWorkerCount;
|
|
3087
3095
|
},
|
|
3088
3096
|
holdsIndex: (indexName) => holdsIndex(state, indexName),
|
|
3089
3097
|
resolvePartition: (indexName, docId) => state.executor.getManager(indexName)?.partitionIdOf(docId),
|
|
@@ -3145,8 +3153,12 @@ function refreshVectorCopies(state, indexName) {
|
|
|
3145
3153
|
async function announceRequestThreads(state, pool) {
|
|
3146
3154
|
const listener = state.requestThreads;
|
|
3147
3155
|
if (listener === null) return;
|
|
3148
|
-
|
|
3149
|
-
|
|
3156
|
+
const entries = pool.executorEntries();
|
|
3157
|
+
for (const { workerId, executor } of entries) {
|
|
3158
|
+
if (pool.isLongQueryWorker(workerId)) await listener.onLongQueryWorkerReady(workerId, executor);
|
|
3159
|
+
}
|
|
3160
|
+
for (const { workerId, executor } of entries) {
|
|
3161
|
+
if (!pool.isLongQueryWorker(workerId)) await listener.onWorkerReady(workerId, executor);
|
|
3150
3162
|
}
|
|
3151
3163
|
}
|
|
3152
3164
|
function scheduleRequestThreadPoolRestart(state) {
|
|
@@ -3167,13 +3179,14 @@ async function serveRequestsOnWorkers(state, listener) {
|
|
|
3167
3179
|
if (!state.workersEnabled) return 0;
|
|
3168
3180
|
state.requestThreads = listener;
|
|
3169
3181
|
state.keywordWorkerCount = resolveRequestThreadCount(state.config?.workers?.count);
|
|
3182
|
+
state.longQueryWorkerCount = LONG_QUERY_THREADS;
|
|
3170
3183
|
if (state.vectorCopyPolicy !== void 0) {
|
|
3171
3184
|
state.vectorCopyPolicy.host = sharedCopyHostOf(state);
|
|
3172
3185
|
state.vectorCopyPolicy.enabled = state.workersEnabled;
|
|
3173
3186
|
}
|
|
3174
3187
|
if (state.poolStart !== null) await state.poolStart.catch(() => void 0);
|
|
3175
3188
|
const running = state.workerPool;
|
|
3176
|
-
if (running !== null && running.workerCount !== state.keywordWorkerCount) {
|
|
3189
|
+
if (running !== null && running.workerCount !== resolveWorkerCount(state.keywordWorkerCount + LONG_QUERY_THREADS)) {
|
|
3177
3190
|
retirePool(state, running);
|
|
3178
3191
|
state.poolRetryAt = 0;
|
|
3179
3192
|
}
|
|
@@ -3285,7 +3298,9 @@ async function replaceWorker(state, pool, workerId) {
|
|
|
3285
3298
|
await loadOntoReplacement(state, replacement, indexName);
|
|
3286
3299
|
}
|
|
3287
3300
|
replacement.admit();
|
|
3288
|
-
|
|
3301
|
+
if (pool.isLongQueryWorker(workerId))
|
|
3302
|
+
await state.requestThreads?.onLongQueryWorkerReady(workerId, replacement.executor);
|
|
3303
|
+
else await state.requestThreads?.onWorkerReady(workerId, replacement.executor);
|
|
3289
3304
|
} catch (err) {
|
|
3290
3305
|
replacement.abandon();
|
|
3291
3306
|
throw err;
|
|
@@ -3344,7 +3359,8 @@ async function startPool(state) {
|
|
|
3344
3359
|
const factory = await createWorkerFactory();
|
|
3345
3360
|
let started = null;
|
|
3346
3361
|
const pool = createWorkerPool({
|
|
3347
|
-
count: state.keywordWorkerCount,
|
|
3362
|
+
count: state.keywordWorkerCount + state.longQueryWorkerCount,
|
|
3363
|
+
longQueryWorkers: state.longQueryWorkerCount,
|
|
3348
3364
|
workerFactory: factory,
|
|
3349
3365
|
onWorkerCrash(workerId, indexNames, error) {
|
|
3350
3366
|
if (started !== null) handleWorkerCrash(state, started, workerId, indexNames, error);
|
|
@@ -3769,6 +3785,7 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
|
|
|
3769
3785
|
vectorCopyPolicy,
|
|
3770
3786
|
workersEnabled: config?.workers?.enabled ?? workersEnabledByDefault(),
|
|
3771
3787
|
keywordWorkerCount: splitWorkerBudget(resolveWorkerCount(config?.workers?.count)).keyword,
|
|
3788
|
+
longQueryWorkerCount: 0,
|
|
3772
3789
|
requestThreads: null,
|
|
3773
3790
|
copyThreshold: config?.workers?.promotionThreshold ?? DEFAULT_COPY_THRESHOLD,
|
|
3774
3791
|
copyIdleTimeoutMs: config?.workers?.idleTimeoutMs ?? copyIdleTimeoutBeforeClose(config?.lifecycle?.idleTimeoutMs),
|
|
@@ -4028,7 +4045,7 @@ async function emitWriteEventAfter(source, indexName, write) {
|
|
|
4028
4045
|
// src/engine/core.ts
|
|
4029
4046
|
async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
4030
4047
|
validateWorkerConfig(config?.workers, config?.lifecycle);
|
|
4031
|
-
const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-
|
|
4048
|
+
const rerankSettings = config?.rerankTimeout === void 0 && config?.maxRerankWindow === void 0 ? { timeoutMs: DEFAULT_RERANK_TIMEOUT_MS, maxWindow: DEFAULT_MAX_RERANK_WINDOW } : (await import('./runtime-XNYW6AWX.mjs')).resolveRerankSettings(config);
|
|
4032
4049
|
const eventHandlers = eventHandlersOf(config?.events);
|
|
4033
4050
|
const vectorWorkerCount = splitWorkerBudget(resolveWorkerCount(config?.workers?.count)).vector;
|
|
4034
4051
|
const vectorCopyPolicy = {
|
|
@@ -4039,7 +4056,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
|
|
|
4039
4056
|
if (config?.lifecycle !== void 0 && durabilityTier === null) {
|
|
4040
4057
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
|
|
4041
4058
|
}
|
|
4042
|
-
const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-
|
|
4059
|
+
const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-5V6DVHFK.mjs');
|
|
4043
4060
|
const filesystemDurability = durabilityTier?.kind === "wal";
|
|
4044
4061
|
const executor = createDirectExecutor({
|
|
4045
4062
|
vectorWorkerCopies: vectorCopyPolicy,
|
|
@@ -4336,7 +4353,7 @@ async function shutdownEngine(core) {
|
|
|
4336
4353
|
}
|
|
4337
4354
|
}
|
|
4338
4355
|
if (core.rerankAdapters.size > 0) {
|
|
4339
|
-
await (await import('./runtime-
|
|
4356
|
+
await (await import('./runtime-XNYW6AWX.mjs')).shutdownRerankAdapters(core.rerankAdapters);
|
|
4340
4357
|
}
|
|
4341
4358
|
await orchestrator.shutdown();
|
|
4342
4359
|
await executor.shutdown();
|
|
@@ -6954,14 +6971,14 @@ function portabilityOperations(core, config, engine) {
|
|
|
6954
6971
|
return {
|
|
6955
6972
|
snapshot(indexName) {
|
|
6956
6973
|
return withOpenIndex(indexName, async () => {
|
|
6957
|
-
const { createSnapshot } = await import('./snapshot-
|
|
6974
|
+
const { createSnapshot } = await import('./snapshot-57WF53MK.mjs');
|
|
6958
6975
|
return createSnapshot(snapshotDepsOf(indexName));
|
|
6959
6976
|
});
|
|
6960
6977
|
},
|
|
6961
6978
|
async restore(indexName, data) {
|
|
6962
6979
|
core.guardShutdown();
|
|
6963
6980
|
validateIndexName(indexName);
|
|
6964
|
-
const restored = import('./restore-queue-
|
|
6981
|
+
const restored = import('./restore-queue-J6PCG4ON.mjs').then(
|
|
6965
6982
|
({ queueRestore }) => queueRestore(core, restoreHost, restoresInFlight, indexName, data)
|
|
6966
6983
|
);
|
|
6967
6984
|
await emitWriteEventAfter(core, indexName, restored);
|
|
@@ -6970,8 +6987,8 @@ function portabilityOperations(core, config, engine) {
|
|
|
6970
6987
|
exportDocuments(indexName) {
|
|
6971
6988
|
return withOpenIndex(indexName, async () => {
|
|
6972
6989
|
const [{ checkpointForArchive }, { documentExportStream }] = await Promise.all([
|
|
6973
|
-
import('./snapshot-
|
|
6974
|
-
import('./write-
|
|
6990
|
+
import('./snapshot-57WF53MK.mjs'),
|
|
6991
|
+
import('./write-YEI7A5OR.mjs')
|
|
6975
6992
|
]);
|
|
6976
6993
|
const header = indexConfigurationOf(core.requireIndex(indexName));
|
|
6977
6994
|
return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
|
|
@@ -7023,7 +7040,7 @@ async function runEngineQuery(core, indexName, params, options) {
|
|
|
7023
7040
|
const manager = core.requireManager(indexName);
|
|
7024
7041
|
const scoped = scopedParams(params, options);
|
|
7025
7042
|
await core.pluginRegistry.runHook("beforeSearch", { indexName, params: scoped });
|
|
7026
|
-
const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-
|
|
7043
|
+
const rerank = scoped.rerank === void 0 ? void 0 : await import('./runtime-XNYW6AWX.mjs');
|
|
7027
7044
|
const resolvedParams = await resolveVectorText(
|
|
7028
7045
|
rerank === void 0 ? scoped : rerank.withRerankQueryText(scoped),
|
|
7029
7046
|
entry.embeddingAdapter,
|
|
@@ -7040,7 +7057,7 @@ async function runEngineQuery(core, indexName, params, options) {
|
|
|
7040
7057
|
broadcastStats: broadcastStatsFor(core, options),
|
|
7041
7058
|
partitionIds: options?.partitionIds,
|
|
7042
7059
|
rescoreWindow: options?.rescoreWindow,
|
|
7043
|
-
cursorBinding:
|
|
7060
|
+
cursorBinding: lazyQueryBinding(params),
|
|
7044
7061
|
patternWorkCap: core.patternWorkCap,
|
|
7045
7062
|
rerank: rerank?.rerankRunnerFor(core)
|
|
7046
7063
|
};
|
|
@@ -7089,7 +7106,7 @@ async function runEnginePreflight(core, indexName, params, options) {
|
|
|
7089
7106
|
indexName,
|
|
7090
7107
|
broadcastStats: broadcastStatsFor(core, options),
|
|
7091
7108
|
partitionIds: options?.partitionIds,
|
|
7092
|
-
cursorBinding:
|
|
7109
|
+
cursorBinding: lazyQueryBinding(params),
|
|
7093
7110
|
patternWorkCap: core.patternWorkCap
|
|
7094
7111
|
};
|
|
7095
7112
|
const { result, analysisStale } = await readUnderOneAnalysis(
|