@delali/narsil 0.3.1-next.91 → 0.3.1-next.95
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-66KYAOIK.mjs → chunk-3U636ADD.mjs} +2 -2
- package/dist/browser/{chunk-NOUZ6RH3.mjs → chunk-D3CC2NMZ.mjs} +238 -114
- package/dist/browser/{chunk-3ZRMZIH4.mjs → chunk-FYFQJKFW.mjs} +208 -78
- package/dist/browser/{chunk-FHFFWLEK.mjs → chunk-HARBSUWP.mjs} +3 -4
- package/dist/browser/{chunk-B6XE7KXY.mjs → chunk-LULHQXCK.mjs} +4 -4
- package/dist/browser/{chunk-NQW2YXEX.mjs → chunk-WKPJ4E73.mjs} +1 -1
- package/dist/browser/{durability-wiring-F4OGQUSU.mjs → durability-wiring-3ZRKSPJD.mjs} +498 -71
- package/dist/browser/{module-E25UDADM.mjs → module-IEOQI5GI.mjs} +102 -54
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-RBULSOVX.mjs +35 -0
- package/dist/browser/{snapshot-5EJ7I7QY.mjs → snapshot-Y3NGUJHX.mjs} +362 -103
- package/dist/browser/{write-K5V4XQ72.mjs → write-ZUBDNLCH.mjs} +4 -4
- package/dist/{capabilities-CvExBThq.d.ts → capabilities-BvxvFzVA.d.ts} +2 -2
- package/dist/{chunk-NVL4ZR3K.mjs → chunk-2GZGBOQI.mjs} +2 -2
- package/dist/{chunk-XLJ2S2BH.mjs → chunk-3LYY62M6.mjs} +40 -21
- package/dist/{chunk-CVQWQVFX.mjs → chunk-4ZJWRETC.mjs} +2 -2
- package/dist/{chunk-T4DB5YFB.mjs → chunk-54HYC5FT.mjs} +6 -6
- package/dist/{chunk-ZIJ63TBT.mjs → chunk-7KC56574.mjs} +1 -1
- package/dist/{chunk-67Z2V6TC.mjs → chunk-7QONURHW.mjs} +3 -3
- package/dist/{chunk-BVOJIYRV.mjs → chunk-BB7MASRQ.mjs} +1 -1
- package/dist/{chunk-6VZ3Q73N.mjs → chunk-CHOGQSHK.mjs} +44 -25
- package/dist/{chunk-QZN3MIJ3.mjs → chunk-ES33L3HO.mjs} +2 -2
- package/dist/{chunk-YCJLVNWR.mjs → chunk-F52QGNZ2.mjs} +1 -1
- package/dist/{chunk-43ORORN6.mjs → chunk-GJZHU4FC.mjs} +3 -3
- package/dist/{chunk-R7OSDAFK.mjs → chunk-HBVLF3HA.mjs} +1 -1
- package/dist/{chunk-ULRPNYAG.mjs → chunk-ICL2AELD.mjs} +120 -62
- package/dist/{chunk-3RDS4UHC.mjs → chunk-J7SDAOTP.mjs} +4 -4
- package/dist/{chunk-A4G7JSYO.mjs → chunk-JFUE6F2Y.mjs} +98 -49
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-7OQHSDK6.mjs → chunk-L26LEDHO.mjs} +7 -7
- package/dist/{chunk-EONIHG3V.mjs → chunk-MASE2LTJ.mjs} +7 -7
- package/dist/{chunk-MXS5HWIH.mjs → chunk-MWT5WCJ5.mjs} +89 -17
- package/dist/{chunk-3TTYK5A7.mjs → chunk-Q4UTU5ZE.mjs} +9 -9
- package/dist/{chunk-T6CNO72J.mjs → chunk-QM3VPX4Z.mjs} +2 -2
- package/dist/chunk-QY7GC2MW.mjs +33 -0
- package/dist/{chunk-BJ2YKRNX.mjs → chunk-R36MIGBU.mjs} +86 -54
- package/dist/{chunk-RVM7AODE.mjs → chunk-RDJKYKMQ.mjs} +2 -2
- package/dist/{chunk-UXQE2ROB.mjs → chunk-RUIXODYU.mjs} +3 -2
- package/dist/{chunk-5ER245FI.mjs → chunk-SBCEHIPL.mjs} +3 -3
- package/dist/{chunk-TPJU7NDJ.mjs → chunk-SYWGORQB.mjs} +1 -0
- package/dist/{chunk-UKSUENHK.mjs → chunk-T2QN2FA4.mjs} +40 -26
- package/dist/{chunk-CO4MRKST.mjs → chunk-WLOF6HSP.mjs} +2 -2
- package/dist/{chunk-MKWUXWQH.mjs → chunk-ZHS44YKF.mjs} +1 -1
- package/dist/{client-Cc42b42j.d.ts → client-DKwterMb.d.ts} +2 -2
- package/dist/client.d.ts +6 -6
- package/dist/client.mjs +1 -0
- package/dist/{config-DyRowvVP.d.ts → config-6YBtxekG.d.ts} +1 -1
- package/dist/{config-BYne-yCI.d.ts → config-DPphZfuM.d.ts} +1 -1
- package/dist/direct-executor-5KJGVQHM.mjs +22 -0
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +5 -5
- package/dist/distribution.mjs +26 -26
- package/dist/{durability-wiring-6AN4QTT3.mjs → durability-wiring-FRPV6JLZ.mjs} +518 -91
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/{engine-96_kLtSY.d.ts → engine-BGt9lI1V.d.ts} +11 -11
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +18 -18
- package/dist/{memory-dd3GESdc.d.ts → memory-COdoGthn.d.ts} +96 -76
- package/dist/{module-WIDYIJLY.mjs → module-IUTNXWMV.mjs} +72 -38
- package/dist/partial-words.mjs +5 -5
- package/dist/pattern.mjs +3 -3
- package/dist/persistence/durability/checkpoint-worker.mjs +21 -21
- package/dist/react.d.ts +6 -6
- package/dist/react.mjs +1 -0
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/restore-queue-I5SI6AUQ.mjs +35 -0
- package/dist/server.d.ts +8 -8
- package/dist/server.mjs +10 -10
- package/dist/snapshot-YC6TS4OP.mjs +738 -0
- package/dist/synonyms.mjs +3 -3
- package/dist/{tasks-DA1Ff0G4.d.ts → tasks-BJmamiC4.d.ts} +1 -1
- package/dist/{thread-VTDLLYXC.mjs → thread-U7XYJWGG.mjs} +15 -12
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +5 -5
- package/dist/{write-OJR3H4BI.mjs → write-M2OALSA4.mjs} +20 -20
- package/package.json +7 -7
- package/dist/chunk-Y2F66IQJ.mjs +0 -74
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/direct-executor-CHXVCBN7.mjs +0 -22
- package/dist/snapshot-JFZVOGZV.mjs +0 -479
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/runtime/simd-support.ts
|
|
2
|
+
var SIMD_PROBE_MODULE = new Uint8Array([
|
|
3
|
+
0,
|
|
4
|
+
97,
|
|
5
|
+
115,
|
|
6
|
+
109,
|
|
7
|
+
1,
|
|
8
|
+
0,
|
|
9
|
+
0,
|
|
10
|
+
0,
|
|
11
|
+
1,
|
|
12
|
+
5,
|
|
13
|
+
1,
|
|
14
|
+
96,
|
|
15
|
+
0,
|
|
16
|
+
1,
|
|
17
|
+
123,
|
|
18
|
+
3,
|
|
19
|
+
2,
|
|
20
|
+
1,
|
|
21
|
+
0,
|
|
22
|
+
10,
|
|
23
|
+
10,
|
|
24
|
+
1,
|
|
25
|
+
8,
|
|
26
|
+
0,
|
|
27
|
+
65,
|
|
28
|
+
0,
|
|
29
|
+
253,
|
|
30
|
+
15,
|
|
31
|
+
253,
|
|
32
|
+
98,
|
|
33
|
+
11
|
|
34
|
+
]);
|
|
35
|
+
function runtimeStartsSimdModule() {
|
|
36
|
+
try {
|
|
37
|
+
if (typeof WebAssembly === "undefined") return false;
|
|
38
|
+
new WebAssembly.Instance(new WebAssembly.Module(SIMD_PROBE_MODULE));
|
|
39
|
+
return true;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var simdAvailable = runtimeStartsSimdModule();
|
|
45
|
+
function isSimdAvailable() {
|
|
46
|
+
return simdAvailable;
|
|
47
|
+
}
|
|
48
|
+
function markSimdUnavailable() {
|
|
49
|
+
simdAvailable = false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { isSimdAvailable, markSimdUnavailable };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { vectorsPerFile } from './chunk-
|
|
2
|
-
import { writeLiveVectors, decodeSegmentManifest, openManifestPayload, listedKeysOf, decodeManifestPayload, SINGLE_NODE_PRIMARY_TERM } from './chunk-
|
|
3
|
-
import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-
|
|
4
|
-
import { writeCheckpointSegments, DEFAULT_COMPACTION_THRESHOLD, commitCheckpointManifest, manifestKey, manifestFileRefs, partitionContentsOf } from './chunk-
|
|
5
|
-
import { HEADER_SIZE } from './chunk-
|
|
6
|
-
import { MAX_FILE_BYTES } from './chunk-
|
|
7
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { vectorsPerFile } from './chunk-MWT5WCJ5.mjs';
|
|
2
|
+
import { writeLiveVectors, decodeSegmentManifest, openManifestPayload, listedKeysOf, decodeManifestPayload, SINGLE_NODE_PRIMARY_TERM } from './chunk-MASE2LTJ.mjs';
|
|
3
|
+
import { vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION } from './chunk-F52QGNZ2.mjs';
|
|
4
|
+
import { writeCheckpointSegments, DEFAULT_COMPACTION_THRESHOLD, commitCheckpointManifest, manifestKey, manifestFileRefs, partitionContentsOf } from './chunk-Q4UTU5ZE.mjs';
|
|
5
|
+
import { HEADER_SIZE } from './chunk-JFUE6F2Y.mjs';
|
|
6
|
+
import { MAX_FILE_BYTES } from './chunk-RDJKYKMQ.mjs';
|
|
7
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
8
8
|
|
|
9
9
|
// src/persistence/archive/memory-store.ts
|
|
10
10
|
function joined(chunks) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead, VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-
|
|
2
|
-
import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, readSegmentFile, readListedFile, requireListedChecksum, vectorFileKey, graphPartKey } from './chunk-
|
|
3
|
-
import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, HEADER_SIZE, packChecksummedEnvelope } from './chunk-
|
|
4
|
-
import { MAX_FILE_BYTES } from './chunk-
|
|
5
|
-
import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-
|
|
6
|
-
import { flattenSchema, requireValidFieldTypes } from './chunk-
|
|
1
|
+
import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead, VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-F52QGNZ2.mjs';
|
|
2
|
+
import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, readSegmentFile, readListedFile, requireListedChecksum, vectorFileKey, graphPartKey } from './chunk-Q4UTU5ZE.mjs';
|
|
3
|
+
import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, HEADER_SIZE, packChecksummedEnvelope } from './chunk-JFUE6F2Y.mjs';
|
|
4
|
+
import { MAX_FILE_BYTES } from './chunk-RDJKYKMQ.mjs';
|
|
5
|
+
import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-3LYY62M6.mjs';
|
|
6
|
+
import { flattenSchema, requireValidFieldTypes } from './chunk-4ZJWRETC.mjs';
|
|
7
7
|
import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
8
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
8
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
9
9
|
import { decode, encode } from '@msgpack/msgpack';
|
|
10
10
|
|
|
11
11
|
// src/engine/durability-metadata.ts
|
|
@@ -1,9 +1,76 @@
|
|
|
1
|
-
import { VECTOR_FILE_MAX_VECTORS, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors, VECTOR_GRAPH_PART_VECTORS, VECTOR_GRAPH_PART_PAYLOAD_VERSION, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, vectorsToBytes } from './chunk-
|
|
2
|
-
import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes } from './chunk-
|
|
1
|
+
import { VECTOR_FILE_MAX_VECTORS, NO_LIVE_VECTOR_AT_POSITION, bytesToVectors, VECTOR_GRAPH_PART_VECTORS, VECTOR_GRAPH_PART_PAYLOAD_VERSION, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, vectorsToBytes } from './chunk-F52QGNZ2.mjs';
|
|
2
|
+
import { createOrdinalFilter, addToOrdinalFilter, osqBitsOf, STORE_ORDINAL_LAYOUT_GENERATION, removeFromOrdinalFilter, createHNSWIndex, STORE_CALIBRATION_GENERATION, graphWithoutNodes } from './chunk-ICL2AELD.mjs';
|
|
3
3
|
import { osqRecordBytes } from './chunk-37CD3OKS.mjs';
|
|
4
|
-
import { MAX_FILE_BYTES } from './chunk-
|
|
4
|
+
import { MAX_FILE_BYTES } from './chunk-RDJKYKMQ.mjs';
|
|
5
5
|
import { MAX_DOC_ID_LENGTH } from './chunk-Q5DC6WAB.mjs';
|
|
6
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
6
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
7
|
+
|
|
8
|
+
// src/vector/filter-ordinals.ts
|
|
9
|
+
var UNRESOLVED_ORDINAL = -1;
|
|
10
|
+
var NO_VECTOR_MARK = -2;
|
|
11
|
+
function freshOrdinals(length) {
|
|
12
|
+
return new Int32Array(length).fill(UNRESOLVED_ORDINAL);
|
|
13
|
+
}
|
|
14
|
+
function mapsOf(owner) {
|
|
15
|
+
owner.vectorOrdinalMaps ??= { bytes: 0, byField: /* @__PURE__ */ new Map() };
|
|
16
|
+
return owner.vectorOrdinalMaps;
|
|
17
|
+
}
|
|
18
|
+
function mapFor(maps, docStore, space, numberingGeneration) {
|
|
19
|
+
const held = maps.byField.get(space.fieldName);
|
|
20
|
+
if (held !== void 0 && held.header === space.header && held.layoutGeneration === space.layoutGeneration && held.numberingGeneration === numberingGeneration) {
|
|
21
|
+
return held;
|
|
22
|
+
}
|
|
23
|
+
const map = {
|
|
24
|
+
header: space.header,
|
|
25
|
+
layoutGeneration: space.layoutGeneration,
|
|
26
|
+
numberingGeneration,
|
|
27
|
+
ordinals: freshOrdinals(docStore.internalIdCapacity())
|
|
28
|
+
};
|
|
29
|
+
maps.bytes += map.ordinals.byteLength - (held?.ordinals.byteLength ?? 0);
|
|
30
|
+
maps.byField.set(space.fieldName, map);
|
|
31
|
+
return map;
|
|
32
|
+
}
|
|
33
|
+
function growTo(maps, map, length) {
|
|
34
|
+
const grown = freshOrdinals(Math.max(length, map.ordinals.length * 2));
|
|
35
|
+
grown.set(map.ordinals);
|
|
36
|
+
maps.bytes += grown.byteLength - map.ordinals.byteLength;
|
|
37
|
+
map.ordinals = grown;
|
|
38
|
+
}
|
|
39
|
+
function ordinalAt(maps, map, internalId, docStore, space) {
|
|
40
|
+
if (internalId >= map.ordinals.length) growTo(maps, map, internalId + 1);
|
|
41
|
+
const held = map.ordinals[internalId];
|
|
42
|
+
if (held >= 0 && space.holdsCurrentOrdinal(held)) return held;
|
|
43
|
+
if (held <= NO_VECTOR_MARK && NO_VECTOR_MARK - held === space.slots) return UNRESOLVED_ORDINAL;
|
|
44
|
+
const docId = docStore.getExternalId(internalId);
|
|
45
|
+
const resolved = docId === void 0 ? void 0 : space.ordinalOf(docId);
|
|
46
|
+
map.ordinals[internalId] = resolved ?? NO_VECTOR_MARK - space.slots;
|
|
47
|
+
return resolved ?? UNRESOLVED_ORDINAL;
|
|
48
|
+
}
|
|
49
|
+
function ordinalFilterForSubsets(subsets, space) {
|
|
50
|
+
const filter = createOrdinalFilter(space.slots);
|
|
51
|
+
for (const subset of subsets) {
|
|
52
|
+
const docStore = subset.owner.docStore;
|
|
53
|
+
if (docStore.numberingGeneration() !== subset.numberingGeneration) continue;
|
|
54
|
+
const resolver = docStore.resolver();
|
|
55
|
+
const maps = mapsOf(subset.owner);
|
|
56
|
+
const map = mapFor(maps, docStore, space, subset.numberingGeneration);
|
|
57
|
+
const bits = subset.bits;
|
|
58
|
+
for (let wordIndex = 0; wordIndex < bits.length; wordIndex++) {
|
|
59
|
+
let word = bits[wordIndex];
|
|
60
|
+
if (word === 0) continue;
|
|
61
|
+
const base = wordIndex << 5;
|
|
62
|
+
while (word !== 0) {
|
|
63
|
+
const internalId = base + (Math.clz32(word & -word) ^ 31);
|
|
64
|
+
word &= word - 1;
|
|
65
|
+
if (!resolver.isLive(internalId)) continue;
|
|
66
|
+
const ordinal = ordinalAt(maps, map, internalId, docStore, space);
|
|
67
|
+
if (ordinal < 0 || space.isRemoved(ordinal)) continue;
|
|
68
|
+
addToOrdinalFilter(filter, ordinal);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return filter;
|
|
73
|
+
}
|
|
7
74
|
|
|
8
75
|
// src/vector/vector-index/constants.ts
|
|
9
76
|
var DEFAULT_PROMOTION_THRESHOLD = 1024;
|
|
@@ -94,25 +161,30 @@ function ordinalFilterForPartitions(state, partitionIds) {
|
|
|
94
161
|
}
|
|
95
162
|
return filter;
|
|
96
163
|
}
|
|
164
|
+
function ordinalSpaceOf(state) {
|
|
165
|
+
const store = state.store;
|
|
166
|
+
const handles = store.handles;
|
|
167
|
+
const removed = new Uint8Array(handles.removed);
|
|
168
|
+
return {
|
|
169
|
+
fieldName: state.fieldName,
|
|
170
|
+
slots: store.slots,
|
|
171
|
+
header: handles.header,
|
|
172
|
+
layoutGeneration: Atomics.load(handles.header, STORE_ORDINAL_LAYOUT_GENERATION),
|
|
173
|
+
ordinalOf: (docId) => store.getOrdinal(docId),
|
|
174
|
+
holdsCurrentOrdinal: (ordinal) => store.holdsOrdinal(ordinal),
|
|
175
|
+
isRemoved: (ordinal) => ordinal < removed.length && removed[ordinal] === 1
|
|
176
|
+
};
|
|
177
|
+
}
|
|
97
178
|
function filterForOptions(state, options) {
|
|
98
|
-
if (options.
|
|
99
|
-
|
|
179
|
+
if (options.filterSubsets !== void 0) {
|
|
180
|
+
if (state.store.dimension === 0) return createOrdinalFilter(0);
|
|
181
|
+
return ordinalFilterForSubsets(options.filterSubsets, ordinalSpaceOf(state));
|
|
100
182
|
}
|
|
101
183
|
if (options.filterPartitions !== void 0) {
|
|
102
184
|
return ordinalFilterForPartitions(state, options.filterPartitions);
|
|
103
185
|
}
|
|
104
186
|
return void 0;
|
|
105
187
|
}
|
|
106
|
-
function ordinalFilterForDocIds(state, docIds) {
|
|
107
|
-
const filter = createOrdinalFilter(state.store.slots);
|
|
108
|
-
for (const docId of docIds) {
|
|
109
|
-
if (state.tombstones.has(docId)) continue;
|
|
110
|
-
const ordinal = state.store.getOrdinal(docId);
|
|
111
|
-
if (ordinal === void 0) continue;
|
|
112
|
-
addToOrdinalFilter(filter, ordinal);
|
|
113
|
-
}
|
|
114
|
-
return filter;
|
|
115
|
-
}
|
|
116
188
|
function liveOrdinals(state) {
|
|
117
189
|
const ordinals = [];
|
|
118
190
|
for (let ordinal = 0; ordinal < state.store.slots; ordinal++) {
|
|
@@ -512,4 +584,4 @@ function recordCheckpoint(state, plan, written) {
|
|
|
512
584
|
state.savedSignature = plan.signature;
|
|
513
585
|
}
|
|
514
586
|
|
|
515
|
-
export { BUILD_CHUNK_SIZE, DEFAULT_FILTER_THRESHOLD, DEFAULT_PROMOTION_THRESHOLD, DISK_ADOPTION_YIELD_INTERVAL, ESTIMATED_MS_PER_TOMBSTONE, ESTIMATED_MS_PER_VECTOR_REBUILD, OSQ4_MIN_DIMENSION, VECTOR_WORKER_COPIES_ALLOWED, WORKER_COPY_MIN_VECTORS, adoptGraph, allLiveDocIds, assignStorePartitions, calibrateQuantizer, deserialize, emptyFieldBeforeRestore, fieldHandlesOf, filterForOptions, graphNeedsRebuild, liveSize, planCheckpoint, recalibrateFromStore, recordCheckpoint, releaseReplacedVectors, signatureOf, threadsHoldCurrentLayout, vectorsPerFile, yieldToEventLoop };
|
|
587
|
+
export { BUILD_CHUNK_SIZE, DEFAULT_FILTER_THRESHOLD, DEFAULT_PROMOTION_THRESHOLD, DISK_ADOPTION_YIELD_INTERVAL, ESTIMATED_MS_PER_TOMBSTONE, ESTIMATED_MS_PER_VECTOR_REBUILD, OSQ4_MIN_DIMENSION, VECTOR_WORKER_COPIES_ALLOWED, WORKER_COPY_MIN_VECTORS, adoptGraph, allLiveDocIds, assignStorePartitions, calibrateQuantizer, deserialize, emptyFieldBeforeRestore, fieldHandlesOf, filterForOptions, graphNeedsRebuild, liveSize, ordinalFilterForSubsets, planCheckpoint, recalibrateFromStore, recordCheckpoint, releaseReplacedVectors, signatureOf, threadsHoldCurrentLayout, vectorsPerFile, yieldToEventLoop };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, restoreVectorFields, KEYWORD_SEGMENT_PAYLOAD_VERSION, littleEndianBytes } from './chunk-
|
|
1
|
+
import { KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, restoreVectorFields, KEYWORD_SEGMENT_PAYLOAD_VERSION, littleEndianBytes } from './chunk-J7SDAOTP.mjs';
|
|
2
2
|
import { ReplicationMessageTypes } from './chunk-OHP7QR33.mjs';
|
|
3
3
|
import { WIRE_BATCH_BUDGET } from './chunk-P36MUFEJ.mjs';
|
|
4
|
-
import { packChecksummedEnvelope, crc32, openChecksummedEnvelope, reconstructSchemaFromMetadata, HEADER_SIZE, prepareDocumentVectors } from './chunk-
|
|
5
|
-
import { MAX_FILE_BYTES } from './chunk-
|
|
6
|
-
import { freezeSegmentShared, createSharedFrozenSegment, createFrozenSegment, createPartitionManager, createPartitionRouter, buildSegmentPayload, resolvePartitionInsertOptions, selectionKeeps, decodeMapWithoutFields, shareSegmentArrays, segmentArraysOf, mergeSegmentContents } from './chunk-
|
|
7
|
-
import { fnv1a, isCompositePartition, survivorDocumentsOf, partitionStateOf } from './chunk-
|
|
8
|
-
import { generateId, getLanguage } from './chunk-
|
|
9
|
-
import { extractVectorFieldsFromSchema, partialFieldsOf, messagePackUpperBoundBytes } from './chunk-
|
|
10
|
-
import { resolveIndexAnalysis } from './chunk-
|
|
11
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
4
|
+
import { packChecksummedEnvelope, crc32, openChecksummedEnvelope, reconstructSchemaFromMetadata, HEADER_SIZE, prepareDocumentVectors } from './chunk-JFUE6F2Y.mjs';
|
|
5
|
+
import { MAX_FILE_BYTES } from './chunk-RDJKYKMQ.mjs';
|
|
6
|
+
import { freezeSegmentShared, createSharedFrozenSegment, createFrozenSegment, createPartitionManager, createPartitionRouter, buildSegmentPayload, resolvePartitionInsertOptions, selectionKeeps, decodeMapWithoutFields, shareSegmentArrays, segmentArraysOf, mergeSegmentContents } from './chunk-3LYY62M6.mjs';
|
|
7
|
+
import { fnv1a, isCompositePartition, survivorDocumentsOf, partitionStateOf } from './chunk-CHOGQSHK.mjs';
|
|
8
|
+
import { generateId, getLanguage } from './chunk-ZHS44YKF.mjs';
|
|
9
|
+
import { extractVectorFieldsFromSchema, partialFieldsOf, messagePackUpperBoundBytes } from './chunk-4ZJWRETC.mjs';
|
|
10
|
+
import { resolveIndexAnalysis } from './chunk-2GZGBOQI.mjs';
|
|
11
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
12
12
|
import { encode, decode } from '@msgpack/msgpack';
|
|
13
13
|
|
|
14
14
|
// src/persistence/durability/constants.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MAX_FILTER_ARRAY_SIZE } from './chunk-WQBCBKY3.mjs';
|
|
2
2
|
import { tabulatedLevenshtein } from './chunk-GES7U2PM.mjs';
|
|
3
|
-
import { parsedTypeOf } from './chunk-
|
|
3
|
+
import { parsedTypeOf } from './chunk-BB7MASRQ.mjs';
|
|
4
4
|
import { codePointCount, exceedsCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
5
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
5
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
6
6
|
|
|
7
7
|
// src/core/bitset.ts
|
|
8
8
|
function createBitSet(capacity) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/vector/constants.ts
|
|
2
|
+
var WASM_PAGE_BYTES = 65536;
|
|
3
|
+
var MAX_WASM_PAGES = 65536;
|
|
4
|
+
var VECTOR_STORE_INITIAL_CAPACITY = 16;
|
|
5
|
+
var VECTOR_BLOCK_INITIAL_SLOTS = 256;
|
|
6
|
+
var DISK_STORAGE_BLOCK_BYTES = 67108864;
|
|
7
|
+
var MAX_VECTOR_ORDINALS = 16777216;
|
|
8
|
+
var UNPLACED_FLAG_CHUNK_ORDINALS = 1024;
|
|
9
|
+
var VECTOR_SCRATCH_SLOTS = 64;
|
|
10
|
+
var SCRATCH_SLOTS_PER_THREAD_POOL = 31;
|
|
11
|
+
var MAX_DOC_ID_TABLE_BYTES = 1073741824;
|
|
12
|
+
var MAX_WORKER_COPIES = 64;
|
|
13
|
+
var VECTOR_SEARCH_TIMEOUT_MS = 3e4;
|
|
14
|
+
var VECTOR_SEARCH_LOAD_TIMEOUT_MS = 3e5;
|
|
15
|
+
var VECTOR_INSERT_TIMEOUT_MS = 6e5;
|
|
16
|
+
var NATIVE_ATTACH_RETRY_MS = 1e3;
|
|
17
|
+
var MAX_RENUMBERED_SEARCH_ATTEMPTS = 3;
|
|
18
|
+
var LOCK_SPIN_ITERATIONS = 128;
|
|
19
|
+
var LOCK_WAIT_SLICE_MS = 20;
|
|
20
|
+
var GRAPH_LOCK_WAIT_SLICE_MS = 1;
|
|
21
|
+
var GRAPH_BUILD_DISPATCH_CHUNK = 64;
|
|
22
|
+
var GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER = 2;
|
|
23
|
+
|
|
24
|
+
// src/vector/osq/constants.ts
|
|
25
|
+
var OSQ_GRID = { 1: 0.798, 2: 1.493, 4: 2.514, 8: 3.922 };
|
|
26
|
+
var OSQ_STEPS = { 1: 1, 2: 3, 4: 15, 8: 255 };
|
|
27
|
+
var OSQ_QUERY_BITS = { 1: 4, 2: 4, 4: 4, 8: 8 };
|
|
28
|
+
var OSQ_LAMBDA = 0.1;
|
|
29
|
+
var OSQ_REFINE_ROUNDS = 5;
|
|
30
|
+
var OSQ_REFINE_TOLERANCE = 1e-8;
|
|
31
|
+
var MIN_OVERSAMPLE = 1;
|
|
32
|
+
|
|
33
|
+
export { DISK_STORAGE_BLOCK_BYTES, GRAPH_BUILD_CHUNKS_IN_FLIGHT_PER_WORKER, GRAPH_BUILD_DISPATCH_CHUNK, GRAPH_LOCK_WAIT_SLICE_MS, LOCK_SPIN_ITERATIONS, LOCK_WAIT_SLICE_MS, MAX_DOC_ID_TABLE_BYTES, MAX_RENUMBERED_SEARCH_ATTEMPTS, MAX_VECTOR_ORDINALS, MAX_WASM_PAGES, MAX_WORKER_COPIES, MIN_OVERSAMPLE, NATIVE_ATTACH_RETRY_MS, OSQ_GRID, OSQ_LAMBDA, OSQ_QUERY_BITS, OSQ_REFINE_ROUNDS, OSQ_REFINE_TOLERANCE, OSQ_STEPS, SCRATCH_SLOTS_PER_THREAD_POOL, UNPLACED_FLAG_CHUNK_ORDINALS, VECTOR_BLOCK_INITIAL_SLOTS, VECTOR_INSERT_TIMEOUT_MS, VECTOR_SCRATCH_SLOTS, VECTOR_SEARCH_LOAD_TIMEOUT_MS, VECTOR_SEARCH_TIMEOUT_MS, VECTOR_STORE_INITIAL_CAPACITY, WASM_PAGE_BYTES };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { clampRowCount, sortSignatureOf, requireSortableFields, resolveProjection, decodePageCursor, requireMatchingCursor, encodePageCursor, requireWithinResultWindow, normalizeSort, fanOutQuery, sortModesOf, applySorting, applyPagination, projectionKeepsField, countsWithoutScores, fanOutMatchCount, fnv1aBytes, validatedFilterOf, createPatternWorkMeter, everyValueFacetConfig, fulltextMatches, mergeFacets, pruneStatsToQueryTerms, partitionsIn, partialWordsToHighlight, partialWordHighlighter, undeclaredFieldOnStrictIndex } from './chunk-
|
|
1
|
+
import { clampRowCount, sortSignatureOf, requireSortableFields, resolveProjection, decodePageCursor, requireMatchingCursor, encodePageCursor, requireWithinResultWindow, normalizeSort, fanOutQuery, sortModesOf, applySorting, applyPagination, projectionKeepsField, countsWithoutScores, fanOutMatchCount, fnv1aBytes, validatedFilterOf, createPatternWorkMeter, everyValueFacetConfig, fulltextMatches, mergeFacets, pruneStatsToQueryTerms, partitionsIn, partialWordsToHighlight, partialWordHighlighter, undeclaredFieldOnStrictIndex, applyPartitionFiltersBitset } from './chunk-CHOGQSHK.mjs';
|
|
2
2
|
import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN, MAX_DOC_ID_LENGTH, DEFAULT_LIMIT, DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, ABSOLUTE_WINDOWS_PATH_PATTERN, MODULE_URL_SCHEME_PATTERN, DEFAULT_OFFSET } from './chunk-Q5DC6WAB.mjs';
|
|
3
|
-
import { MIN_OVERSAMPLE } from './chunk-
|
|
4
|
-
import { partialFieldsOf, flattenSchema } from './chunk-
|
|
3
|
+
import { MIN_OVERSAMPLE, MAX_RENUMBERED_SEARCH_ATTEMPTS } from './chunk-QY7GC2MW.mjs';
|
|
4
|
+
import { partialFieldsOf, flattenSchema } from './chunk-4ZJWRETC.mjs';
|
|
5
5
|
import { DEFAULT_MAX_PER_GROUP, DEFAULT_LINEAR_ALPHA, MIN_LINEAR_ALPHA, MAX_LINEAR_ALPHA, DEFAULT_RANK_CONSTANT, MIN_RANK_CONSTANT, DEFAULT_FUZZY_PREFIX_LENGTH, RESULT_WINDOW, MAX_TOLERANCE, MAX_PREFIX_LENGTH } from './chunk-FGMGUDHX.mjs';
|
|
6
6
|
import { fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
|
|
7
|
-
import { isWordIndexedFieldType } from './chunk-
|
|
8
|
-
import { tokenize } from './chunk-
|
|
7
|
+
import { isWordIndexedFieldType } from './chunk-BB7MASRQ.mjs';
|
|
8
|
+
import { tokenize } from './chunk-7KC56574.mjs';
|
|
9
9
|
import { compareComparableKeys } from './chunk-R6A773WK.mjs';
|
|
10
10
|
import { holdsUnpairedSurrogate, compareCodePoints } from './chunk-YTJCGKM4.mjs';
|
|
11
11
|
import { MIN_PATTERN_VALUE_LIMIT, MAX_PATTERN_VALUE_LIMIT, isGeopointOrVectorType, VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
|
|
12
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
12
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
13
13
|
|
|
14
14
|
// src/search/cursor-binding.ts
|
|
15
15
|
var ABSENT_TAG = 0;
|
|
@@ -321,17 +321,6 @@ function searchOptionsFor(manager, patternWork) {
|
|
|
321
321
|
patternWork
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function collectFilterDocIds(manager, params, schema, partitionIds, patternWork) {
|
|
325
|
-
const filterDocIds = /* @__PURE__ */ new Set();
|
|
326
|
-
if (!params.filters) return filterDocIds;
|
|
327
|
-
for (const partition of partitionsFor(manager, partitionIds)) {
|
|
328
|
-
const partitionFiltered = partition.applyFilters(params.filters, schema, patternWork);
|
|
329
|
-
for (const docId of partitionFiltered) {
|
|
330
|
-
filterDocIds.add(docId);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return filterDocIds;
|
|
334
|
-
}
|
|
335
324
|
function vectorResultsToScored(results) {
|
|
336
325
|
return results.map((r) => ({
|
|
337
326
|
docId: r.docId,
|
|
@@ -1193,6 +1182,47 @@ function minMaxNormalize(docs) {
|
|
|
1193
1182
|
return docs.map((d) => ({ docId: d.docId, score: (d.score - min) / range }));
|
|
1194
1183
|
}
|
|
1195
1184
|
|
|
1185
|
+
// src/engine/query/filter-subsets.ts
|
|
1186
|
+
function collectFilterSubsets(manager, filters, schema, partitionIds, patternWork) {
|
|
1187
|
+
const subsets = [];
|
|
1188
|
+
for (const partition of partitionsFor(manager, partitionIds)) {
|
|
1189
|
+
for (const state of partition.readStates()) {
|
|
1190
|
+
subsets.push({
|
|
1191
|
+
owner: state,
|
|
1192
|
+
bits: applyPartitionFiltersBitset(state, filters, schema, patternWork),
|
|
1193
|
+
numberingGeneration: state.docStore.numberingGeneration()
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return subsets;
|
|
1198
|
+
}
|
|
1199
|
+
function filterSubsetsMatchNothing(subsets) {
|
|
1200
|
+
for (const subset of subsets) {
|
|
1201
|
+
for (let wordIndex = 0; wordIndex < subset.bits.length; wordIndex++) {
|
|
1202
|
+
if (subset.bits[wordIndex] !== 0) return false;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
function filterSubsetsRenumbered(subsets) {
|
|
1208
|
+
return subsets.some((subset) => subset.owner.docStore.numberingGeneration() !== subset.numberingGeneration);
|
|
1209
|
+
}
|
|
1210
|
+
async function searchCurrentSubsets(fieldName, first, collectAgain, search) {
|
|
1211
|
+
let subsets = first;
|
|
1212
|
+
for (let attempt = 1; ; attempt++) {
|
|
1213
|
+
const answer = await search(subsets);
|
|
1214
|
+
if (!filterSubsetsRenumbered(subsets)) return answer;
|
|
1215
|
+
if (attempt >= MAX_RENUMBERED_SEARCH_ATTEMPTS) {
|
|
1216
|
+
throw new NarsilError(
|
|
1217
|
+
ErrorCodes.WORKER_BUSY,
|
|
1218
|
+
`The index renumbered its documents during each of ${attempt} filtered searches of vector field "${fieldName}"`,
|
|
1219
|
+
{ fieldName, attempts: attempt }
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
subsets = collectAgain();
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1196
1226
|
// src/engine/query/vector.ts
|
|
1197
1227
|
function oversampleOf(vectorConfig) {
|
|
1198
1228
|
const oversample = vectorConfig.oversample;
|
|
@@ -1217,8 +1247,36 @@ function vectorFetchDepth(limit, offset, cursorDepth) {
|
|
|
1217
1247
|
}
|
|
1218
1248
|
return Math.min(reach + 1, RESULT_WINDOW);
|
|
1219
1249
|
}
|
|
1250
|
+
function filteredSearchOf(params, context) {
|
|
1251
|
+
const filters = params.filters;
|
|
1252
|
+
if (!filters) return void 0;
|
|
1253
|
+
const { manager, config, partitionIds, patternWork } = context;
|
|
1254
|
+
const collectAgain = () => collectFilterSubsets(manager, filters, config.schema, partitionIds, patternWork);
|
|
1255
|
+
return { first: collectAgain(), collectAgain };
|
|
1256
|
+
}
|
|
1257
|
+
function searchField(vecIndex, vectorConfig, queryVector, k, context, filtered) {
|
|
1258
|
+
const options = {
|
|
1259
|
+
metric: vectorConfig.metric ?? "cosine",
|
|
1260
|
+
minSimilarity: vectorConfig.similarity ?? -Infinity,
|
|
1261
|
+
efSearch: vectorConfig.efSearch,
|
|
1262
|
+
oversample: oversampleOf(vectorConfig)
|
|
1263
|
+
};
|
|
1264
|
+
if (filtered !== void 0) {
|
|
1265
|
+
return searchCurrentSubsets(
|
|
1266
|
+
vecIndex.fieldName,
|
|
1267
|
+
filtered.first,
|
|
1268
|
+
filtered.collectAgain,
|
|
1269
|
+
(filterSubsets) => vecIndex.searchParallel(queryVector, k, { ...options, filterSubsets })
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
const filterPartitions = partitionsForVectorSearch(context.manager, vecIndex, context.partitionIds);
|
|
1273
|
+
return vecIndex.searchParallel(
|
|
1274
|
+
queryVector,
|
|
1275
|
+
k,
|
|
1276
|
+
filterPartitions === void 0 ? options : { ...options, filterPartitions }
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1220
1279
|
async function executeVectorSearch(params, context, limit, offset, cursorDepth = 0) {
|
|
1221
|
-
const { manager, config, partitionIds } = context;
|
|
1222
1280
|
const vectorConfig = params.vector;
|
|
1223
1281
|
if (!vectorConfig || !vectorConfig.value) {
|
|
1224
1282
|
return { scored: [], totalMatched: 0 };
|
|
@@ -1227,26 +1285,13 @@ async function executeVectorSearch(params, context, limit, offset, cursorDepth =
|
|
|
1227
1285
|
if (!vecIndex) {
|
|
1228
1286
|
return { scored: [], totalMatched: 0 };
|
|
1229
1287
|
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
filterDocIds = collectFilterDocIds(manager, params, config.schema, partitionIds, context.patternWork);
|
|
1234
|
-
if (filterDocIds.size === 0) {
|
|
1235
|
-
return { scored: [], totalMatched: 0 };
|
|
1236
|
-
}
|
|
1237
|
-
} else {
|
|
1238
|
-
filterPartitions = partitionsForVectorSearch(manager, vecIndex, partitionIds);
|
|
1288
|
+
const filtered = filteredSearchOf(params, context);
|
|
1289
|
+
if (filtered !== void 0 && filterSubsetsMatchNothing(filtered.first)) {
|
|
1290
|
+
return { scored: [], totalMatched: 0 };
|
|
1239
1291
|
}
|
|
1240
1292
|
const queryVec = new Float32Array(vectorConfig.value);
|
|
1241
1293
|
const k = vectorFetchDepth(limit, offset, cursorDepth);
|
|
1242
|
-
const outcome = await vecIndex
|
|
1243
|
-
metric: vectorConfig.metric ?? "cosine",
|
|
1244
|
-
minSimilarity: vectorConfig.similarity ?? -Infinity,
|
|
1245
|
-
...filterDocIds !== void 0 ? { filterDocIds } : {},
|
|
1246
|
-
...filterPartitions !== void 0 ? { filterPartitions } : {},
|
|
1247
|
-
efSearch: vectorConfig.efSearch,
|
|
1248
|
-
oversample: oversampleOf(vectorConfig)
|
|
1249
|
-
});
|
|
1294
|
+
const outcome = await searchField(vecIndex, vectorConfig, queryVec, k, context, filtered);
|
|
1250
1295
|
const scored = vectorResultsToScored(outcome.results);
|
|
1251
1296
|
return { scored, totalMatched: outcome.matched, matchedExact: outcome.matchedExact };
|
|
1252
1297
|
}
|
|
@@ -1272,34 +1317,21 @@ async function textLeg(textOnlyParams, context) {
|
|
|
1272
1317
|
searchOptionsFor(manager, context.patternWork)
|
|
1273
1318
|
);
|
|
1274
1319
|
}
|
|
1275
|
-
async function vectorLeg(vectorConfig, queryVector, context,
|
|
1276
|
-
const { manager } = context;
|
|
1320
|
+
async function vectorLeg(vectorConfig, queryVector, context, filtered, k) {
|
|
1277
1321
|
const vecIndex = resolveVectorIndex(context, vectorConfig.field);
|
|
1278
1322
|
if (!vecIndex) return { scored: [], holdsEveryMatch: true };
|
|
1279
|
-
const
|
|
1280
|
-
const outcome = await vecIndex.searchParallel(queryVector, k, {
|
|
1281
|
-
metric: vectorConfig.metric ?? "cosine",
|
|
1282
|
-
minSimilarity: vectorConfig.similarity ?? -Infinity,
|
|
1283
|
-
...filterDocIds !== void 0 ? { filterDocIds } : {},
|
|
1284
|
-
...filterPartitions !== void 0 ? { filterPartitions } : {},
|
|
1285
|
-
efSearch: vectorConfig.efSearch,
|
|
1286
|
-
oversample: oversampleOf(vectorConfig)
|
|
1287
|
-
});
|
|
1323
|
+
const outcome = await searchField(vecIndex, vectorConfig, queryVector, k, context, filtered);
|
|
1288
1324
|
return {
|
|
1289
1325
|
scored: vectorResultsToScored(outcome.results),
|
|
1290
1326
|
holdsEveryMatch: outcome.matchedExact && outcome.results.length === outcome.matched
|
|
1291
1327
|
};
|
|
1292
1328
|
}
|
|
1293
1329
|
async function executeHybridSearch(params, context, limit, offset, cursorDepth = 0) {
|
|
1294
|
-
const { manager, config } = context;
|
|
1295
1330
|
const { vector: vectorConfig, mode: _mode, hybrid: _hybrid, ...textOnlyParams } = params;
|
|
1296
1331
|
const fusion = resolveHybridFusion(params.hybrid);
|
|
1297
|
-
|
|
1298
|
-
if (
|
|
1299
|
-
|
|
1300
|
-
if (filterDocIds.size === 0) {
|
|
1301
|
-
return { scored: [], totalMatched: 0 };
|
|
1302
|
-
}
|
|
1332
|
+
const filtered = filteredSearchOf(params, context);
|
|
1333
|
+
if (filtered !== void 0 && filterSubsetsMatchNothing(filtered.first)) {
|
|
1334
|
+
return { scored: [], totalMatched: 0 };
|
|
1303
1335
|
}
|
|
1304
1336
|
if (!vectorConfig || !vectorConfig.value) {
|
|
1305
1337
|
const textOnly = await textLeg(textOnlyParams, context);
|
|
@@ -1309,7 +1341,7 @@ async function executeHybridSearch(params, context, limit, offset, cursorDepth =
|
|
|
1309
1341
|
vectorConfig,
|
|
1310
1342
|
new Float32Array(vectorConfig.value),
|
|
1311
1343
|
context,
|
|
1312
|
-
|
|
1344
|
+
filtered,
|
|
1313
1345
|
vectorFetchDepth(limit, offset, cursorDepth)
|
|
1314
1346
|
);
|
|
1315
1347
|
const [textFanOutResult, vectorOutcome] = await Promise.all([textLeg(textOnlyParams, context), vectorPending]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SCRATCH_SLOTS_PER_THREAD_POOL } from './chunk-
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { SCRATCH_SLOTS_PER_THREAD_POOL } from './chunk-QY7GC2MW.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
3
3
|
|
|
4
4
|
// src/serialization/constants.ts
|
|
5
5
|
var CHECKSUM_YIELD_CHUNK_BYTES = 4 * 1024 * 1024;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { nativeSearchCoreIsEnabled } from './chunk-DJHHF2L5.mjs';
|
|
2
|
-
import { loadNativeCore } from './chunk-
|
|
2
|
+
import { loadNativeCore } from './chunk-ES33L3HO.mjs';
|
|
3
3
|
import { MAX_FILTER_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
4
4
|
import { MAX_SORT_FIELDS } from './chunk-FGMGUDHX.mjs';
|
|
5
|
-
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-
|
|
5
|
+
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-SYWGORQB.mjs';
|
|
6
6
|
import { mkdtemp, open, rm } from 'fs/promises';
|
|
7
7
|
import { tmpdir } from 'os';
|
|
8
8
|
import path from 'path';
|
|
@@ -137,6 +137,7 @@ var STATUS_BY_CODE = {
|
|
|
137
137
|
DOC_ALREADY_EXISTS: 409,
|
|
138
138
|
PARTITION_REBALANCING_BACKPRESSURE: 409,
|
|
139
139
|
PARTITION_CAPACITY_EXCEEDED: 409,
|
|
140
|
+
RESTORE_MEMORY_EXCEEDED: 507,
|
|
140
141
|
WORKER_BUSY: 429,
|
|
141
142
|
PARTITION_CORRUPTED: 503,
|
|
142
143
|
WORKER_CRASHED: 503,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { flattenSchema } from './chunk-
|
|
1
|
+
import { flattenSchema } from './chunk-4ZJWRETC.mjs';
|
|
2
2
|
import { PARTIAL_WORD_MIN_CODE_POINTS, PARTIAL_WORDS_ADDED_PER_QUERY, DEFAULT_FUZZY_PREFIX_LENGTH } from './chunk-FGMGUDHX.mjs';
|
|
3
3
|
import { fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
|
|
4
|
-
import { isWordIndexedBase } from './chunk-
|
|
5
|
-
import { encodeStringBlob, tokenize, resolveStopWords, transformToken, visitTokens, visitSurfaceSpellings } from './chunk-
|
|
4
|
+
import { isWordIndexedBase } from './chunk-BB7MASRQ.mjs';
|
|
5
|
+
import { encodeStringBlob, tokenize, resolveStopWords, transformToken, visitTokens, visitSurfaceSpellings } from './chunk-7KC56574.mjs';
|
|
6
6
|
import { compareCodePoints, codePointCount } from './chunk-YTJCGKM4.mjs';
|
|
7
7
|
|
|
8
8
|
// src/core/partition/suggestions.ts
|
|
@@ -36,6 +36,7 @@ var ErrorCodes = {
|
|
|
36
36
|
ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
|
|
37
37
|
ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
|
|
38
38
|
PARTITION_CAPACITY_EXCEEDED: "PARTITION_CAPACITY_EXCEEDED",
|
|
39
|
+
RESTORE_MEMORY_EXCEEDED: "RESTORE_MEMORY_EXCEEDED",
|
|
39
40
|
EMBEDDING_FAILED: "EMBEDDING_FAILED",
|
|
40
41
|
EMBEDDING_DIMENSION_MISMATCH: "EMBEDDING_DIMENSION_MISMATCH",
|
|
41
42
|
EMBEDDING_NO_SOURCE: "EMBEDDING_NO_SOURCE",
|