@delali/narsil 0.2.0 → 0.2.1-next.25
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.d.ts +23 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +25 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +14 -1
- package/dist/adapters-CVqI5NBt.d.ts +149 -0
- package/dist/{chunk-S6IAXOBA.mjs → chunk-ASI6AOW2.mjs} +1 -1
- package/dist/{chunk-AUMKFYTG.mjs → chunk-FKK76OR7.mjs} +56 -55
- package/dist/{chunk-M2EDG55Y.mjs → chunk-UNJZ7ZDB.mjs} +10 -0
- package/dist/{chunk-XAKNSWIK.mjs → chunk-WLR5BFL3.mjs} +16 -14
- package/dist/config-CAjTHzkH.d.ts +256 -0
- package/dist/{direct-executor-2FV3MEDD.mjs → direct-executor-3W4QRA4E.mjs} +2 -2
- package/dist/distribution/coordinator/etcd.d.ts +44 -3
- package/dist/distribution/coordinator/etcd.mjs +2 -2
- package/dist/distribution/coordinator/in-memory.d.ts +14 -3
- package/dist/distribution.d.ts +312 -45
- package/dist/distribution.mjs +4 -4
- package/dist/embeddings/openai.d.ts +28 -1
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/engine-CCrlfLyq.d.ts +431 -0
- package/dist/index.browser.mjs +24 -12
- package/dist/index.d.ts +173 -8
- package/dist/index.mjs +3 -3
- package/dist/invalidation/broadcast-channel.d.ts +20 -1
- package/dist/invalidation/filesystem.d.ts +24 -1
- package/dist/invalidation/noop.d.ts +14 -1
- package/dist/language-DB8KG1z5.d.ts +53 -0
- package/dist/languages/albanian.d.ts +11 -1
- package/dist/languages/amharic.d.ts +11 -1
- package/dist/languages/arabic.d.ts +10 -1
- package/dist/languages/armenian.d.ts +10 -1
- package/dist/languages/azerbaijani.d.ts +11 -1
- package/dist/languages/bambara.d.ts +11 -1
- package/dist/languages/basque.d.ts +10 -1
- package/dist/languages/belarusian.d.ts +11 -1
- package/dist/languages/bengali.d.ts +11 -1
- package/dist/languages/bosnian.d.ts +11 -1
- package/dist/languages/breton.d.ts +11 -1
- package/dist/languages/bulgarian.d.ts +10 -1
- package/dist/languages/burmese.d.ts +11 -1
- package/dist/languages/catalan.d.ts +10 -1
- package/dist/languages/chinese.d.ts +11 -1
- package/dist/languages/croatian.d.ts +11 -1
- package/dist/languages/czech.d.ts +10 -1
- package/dist/languages/dagbani.d.ts +11 -1
- package/dist/languages/danish.d.ts +10 -1
- package/dist/languages/dutch.d.ts +10 -1
- package/dist/languages/english.d.ts +10 -1
- package/dist/languages/esperanto.d.ts +10 -1
- package/dist/languages/estonian.d.ts +10 -1
- package/dist/languages/ewe.d.ts +11 -1
- package/dist/languages/faroese.d.ts +11 -1
- package/dist/languages/fijian.d.ts +11 -1
- package/dist/languages/finnish.d.ts +10 -1
- package/dist/languages/french.d.ts +10 -1
- package/dist/languages/ga.d.ts +11 -1
- package/dist/languages/galician.d.ts +11 -1
- package/dist/languages/georgian.d.ts +11 -1
- package/dist/languages/german.d.ts +10 -1
- package/dist/languages/greek.d.ts +10 -1
- package/dist/languages/guarani.d.ts +11 -1
- package/dist/languages/gujarati.d.ts +11 -1
- package/dist/languages/haitian-creole.d.ts +11 -1
- package/dist/languages/hausa.d.ts +11 -1
- package/dist/languages/hawaiian.d.ts +11 -1
- package/dist/languages/hebrew.d.ts +11 -1
- package/dist/languages/hindi.d.ts +10 -1
- package/dist/languages/hungarian.d.ts +10 -1
- package/dist/languages/icelandic.d.ts +11 -1
- package/dist/languages/igbo.d.ts +11 -1
- package/dist/languages/indonesian.d.ts +10 -1
- package/dist/languages/irish.d.ts +10 -1
- package/dist/languages/italian.d.ts +10 -1
- package/dist/languages/japanese.d.ts +11 -1
- package/dist/languages/kannada.d.ts +11 -1
- package/dist/languages/kazakh.d.ts +11 -1
- package/dist/languages/khmer.d.ts +11 -1
- package/dist/languages/kinyarwanda.d.ts +11 -1
- package/dist/languages/kirundi.d.ts +11 -1
- package/dist/languages/korean.d.ts +11 -1
- package/dist/languages/kurmanji.d.ts +11 -1
- package/dist/languages/kyrgyz.d.ts +11 -1
- package/dist/languages/lao.d.ts +11 -1
- package/dist/languages/latin.d.ts +11 -1
- package/dist/languages/latvian.d.ts +11 -1
- package/dist/languages/lingala.d.ts +11 -1
- package/dist/languages/lithuanian.d.ts +10 -1
- package/dist/languages/luxembourgish.d.ts +11 -1
- package/dist/languages/macedonian.d.ts +11 -1
- package/dist/languages/malagasy.d.ts +11 -1
- package/dist/languages/malay.d.ts +11 -1
- package/dist/languages/malayalam.d.ts +11 -1
- package/dist/languages/maltese.d.ts +11 -1
- package/dist/languages/maori.d.ts +11 -1
- package/dist/languages/marathi.d.ts +11 -1
- package/dist/languages/nepali.d.ts +10 -1
- package/dist/languages/norwegian.d.ts +10 -1
- package/dist/languages/oromo.d.ts +11 -1
- package/dist/languages/persian.d.ts +10 -1
- package/dist/languages/polish.d.ts +10 -1
- package/dist/languages/portuguese.d.ts +10 -1
- package/dist/languages/punjabi.d.ts +11 -1
- package/dist/languages/romanian.d.ts +10 -1
- package/dist/languages/russian.d.ts +10 -1
- package/dist/languages/samoan.d.ts +11 -1
- package/dist/languages/sanskrit.d.ts +10 -1
- package/dist/languages/scottish-gaelic.d.ts +11 -1
- package/dist/languages/serbian.d.ts +10 -1
- package/dist/languages/shona.d.ts +11 -1
- package/dist/languages/sinhala.d.ts +11 -1
- package/dist/languages/slovak.d.ts +11 -1
- package/dist/languages/slovenian.d.ts +10 -1
- package/dist/languages/sorani.d.ts +11 -1
- package/dist/languages/spanish.d.ts +10 -1
- package/dist/languages/swahili.d.ts +10 -1
- package/dist/languages/swedish.d.ts +10 -1
- package/dist/languages/tagalog.d.ts +11 -1
- package/dist/languages/tamil.d.ts +10 -1
- package/dist/languages/tatar.d.ts +11 -1
- package/dist/languages/telugu.d.ts +11 -1
- package/dist/languages/thai.d.ts +11 -1
- package/dist/languages/tibetan.d.ts +11 -1
- package/dist/languages/tigrinya.d.ts +11 -1
- package/dist/languages/tongan.d.ts +11 -1
- package/dist/languages/turkish.d.ts +10 -1
- package/dist/languages/twi.d.ts +11 -1
- package/dist/languages/ukrainian.d.ts +10 -1
- package/dist/languages/urdu.d.ts +11 -1
- package/dist/languages/vietnamese.d.ts +11 -1
- package/dist/languages/welsh.d.ts +11 -1
- package/dist/languages/wolof.d.ts +11 -1
- package/dist/languages/xhosa.d.ts +11 -1
- package/dist/languages/yoruba.d.ts +11 -1
- package/dist/languages/zulu.d.ts +11 -1
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +3 -3
- package/dist/schema-CE6S_aAr.d.ts +208 -0
- package/dist/search-CgQQIciB.d.ts +786 -0
- package/dist/server.d.ts +213 -12
- package/dist/server.mjs +29 -1
- package/dist/types-BV3nAKTL.d.ts +302 -0
- package/dist/vector/hnsw-build-worker.d.ts +68 -2
- package/dist/vector/hnsw-build-worker.mjs +0 -2
- package/dist/workers/entry.mjs +1 -1
- package/package.json +5 -2
- package/dist/adapters-Bo2JQg8b.d.ts +0 -37
- package/dist/config-P27AtSn4.d.ts +0 -502
- package/dist/language-CmJBHf1j.d.ts +0 -17
- package/dist/narsil-CMZRPDlQ.d.ts +0 -159
- package/dist/schema-BnvLvjRp.d.ts +0 -67
- package/dist/types-BRTcBgAp.d.ts +0 -73
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
import { b as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-Bo2JQg8b.js';
|
|
2
|
-
import { A as AnyDocument, c as ScoringMode, b as SchemaDefinition, I as IndexConfig } from './schema-BnvLvjRp.js';
|
|
3
|
-
|
|
4
|
-
declare const ErrorCodes: {
|
|
5
|
-
readonly SCHEMA_INVALID_TYPE: "SCHEMA_INVALID_TYPE";
|
|
6
|
-
readonly SCHEMA_MISSING_FIELD: "SCHEMA_MISSING_FIELD";
|
|
7
|
-
readonly SCHEMA_DEPTH_EXCEEDED: "SCHEMA_DEPTH_EXCEEDED";
|
|
8
|
-
readonly SCHEMA_INVALID_VECTOR_DIMENSION: "SCHEMA_INVALID_VECTOR_DIMENSION";
|
|
9
|
-
readonly SCHEMA_INVALID_GEOPOINT: "SCHEMA_INVALID_GEOPOINT";
|
|
10
|
-
readonly DOC_NOT_FOUND: "DOC_NOT_FOUND";
|
|
11
|
-
readonly DOC_ALREADY_EXISTS: "DOC_ALREADY_EXISTS";
|
|
12
|
-
readonly DOC_VALIDATION_FAILED: "DOC_VALIDATION_FAILED";
|
|
13
|
-
readonly INDEX_NOT_FOUND: "INDEX_NOT_FOUND";
|
|
14
|
-
readonly INDEX_ALREADY_EXISTS: "INDEX_ALREADY_EXISTS";
|
|
15
|
-
readonly PARTITION_CORRUPTED: "PARTITION_CORRUPTED";
|
|
16
|
-
readonly PARTITION_REBALANCING_BACKPRESSURE: "PARTITION_REBALANCING_BACKPRESSURE";
|
|
17
|
-
readonly WORKER_CRASHED: "WORKER_CRASHED";
|
|
18
|
-
readonly WORKER_BUSY: "WORKER_BUSY";
|
|
19
|
-
readonly WORKER_TIMEOUT: "WORKER_TIMEOUT";
|
|
20
|
-
readonly PERSISTENCE_SAVE_FAILED: "PERSISTENCE_SAVE_FAILED";
|
|
21
|
-
readonly PERSISTENCE_LOAD_FAILED: "PERSISTENCE_LOAD_FAILED";
|
|
22
|
-
readonly PERSISTENCE_DELETE_FAILED: "PERSISTENCE_DELETE_FAILED";
|
|
23
|
-
readonly PERSISTENCE_CRC_MISMATCH: "PERSISTENCE_CRC_MISMATCH";
|
|
24
|
-
readonly PERSISTENCE_WAL_CORRUPT: "PERSISTENCE_WAL_CORRUPT";
|
|
25
|
-
readonly PERSISTENCE_FSYNC_FAILED: "PERSISTENCE_FSYNC_FAILED";
|
|
26
|
-
readonly SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD";
|
|
27
|
-
readonly SEARCH_INVALID_VECTOR_SIZE: "SEARCH_INVALID_VECTOR_SIZE";
|
|
28
|
-
readonly VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH";
|
|
29
|
-
readonly SEARCH_INVALID_FILTER: "SEARCH_INVALID_FILTER";
|
|
30
|
-
readonly SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE";
|
|
31
|
-
readonly SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR";
|
|
32
|
-
readonly LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED";
|
|
33
|
-
readonly ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH";
|
|
34
|
-
readonly ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC";
|
|
35
|
-
readonly PARTITION_CAPACITY_EXCEEDED: "PARTITION_CAPACITY_EXCEEDED";
|
|
36
|
-
readonly EMBEDDING_FAILED: "EMBEDDING_FAILED";
|
|
37
|
-
readonly EMBEDDING_DIMENSION_MISMATCH: "EMBEDDING_DIMENSION_MISMATCH";
|
|
38
|
-
readonly EMBEDDING_NO_SOURCE: "EMBEDDING_NO_SOURCE";
|
|
39
|
-
readonly EMBEDDING_CONFIG_INVALID: "EMBEDDING_CONFIG_INVALID";
|
|
40
|
-
readonly DOC_MISSING_REQUIRED_FIELD: "DOC_MISSING_REQUIRED_FIELD";
|
|
41
|
-
readonly CONFIG_INVALID: "CONFIG_INVALID";
|
|
42
|
-
readonly QUERY_ROUTING_FAILED: "QUERY_ROUTING_FAILED";
|
|
43
|
-
readonly QUERY_PARTIAL_FAILURE: "QUERY_PARTIAL_FAILURE";
|
|
44
|
-
readonly QUERY_NODE_TIMEOUT: "QUERY_NODE_TIMEOUT";
|
|
45
|
-
readonly QUERY_NO_ACTIVE_REPLICA: "QUERY_NO_ACTIVE_REPLICA";
|
|
46
|
-
readonly ALLOCATION_NO_DATA_NODES: "ALLOCATION_NO_DATA_NODES";
|
|
47
|
-
readonly ALLOCATION_INVALID_CONFIG: "ALLOCATION_INVALID_CONFIG";
|
|
48
|
-
readonly ALLOCATION_FAILED: "ALLOCATION_FAILED";
|
|
49
|
-
readonly CONTROLLER_LEASE_LOST: "CONTROLLER_LEASE_LOST";
|
|
50
|
-
readonly CONTROLLER_NOT_ACTIVE: "CONTROLLER_NOT_ACTIVE";
|
|
51
|
-
readonly CONTROLLER_METADATA_INVALID: "CONTROLLER_METADATA_INVALID";
|
|
52
|
-
readonly NODE_BOOTSTRAP_FAILED: "NODE_BOOTSTRAP_FAILED";
|
|
53
|
-
readonly NODE_ALREADY_JOINED: "NODE_ALREADY_JOINED";
|
|
54
|
-
readonly NODE_NOT_JOINED: "NODE_NOT_JOINED";
|
|
55
|
-
readonly COORDINATOR_DEPENDENCY_MISSING: "COORDINATOR_DEPENDENCY_MISSING";
|
|
56
|
-
readonly REPLICATION_ENTRY_INVALID: "REPLICATION_ENTRY_INVALID";
|
|
57
|
-
readonly REPLICATION_INSYNC_REMOVAL_FAILED: "REPLICATION_INSYNC_REMOVAL_FAILED";
|
|
58
|
-
readonly REPLICATION_ROLLBACK_FAILED: "REPLICATION_ROLLBACK_FAILED";
|
|
59
|
-
readonly REPLICATION_LOG_FULL: "REPLICATION_LOG_FULL";
|
|
60
|
-
readonly REPLICATION_ENTRY_CORRUPT: "REPLICATION_ENTRY_CORRUPT";
|
|
61
|
-
readonly REPLICATION_SNAPSHOT_CORRUPT: "REPLICATION_SNAPSHOT_CORRUPT";
|
|
62
|
-
readonly REPLICATION_TERM_MISMATCH: "REPLICATION_TERM_MISMATCH";
|
|
63
|
-
readonly REPLICATION_SYNC_FAILED: "REPLICATION_SYNC_FAILED";
|
|
64
|
-
readonly PARTITION_NOT_PRIMARY: "PARTITION_NOT_PRIMARY";
|
|
65
|
-
readonly PARTITION_UNASSIGNED: "PARTITION_UNASSIGNED";
|
|
66
|
-
readonly INSUFFICIENT_REPLICAS: "INSUFFICIENT_REPLICAS";
|
|
67
|
-
readonly SNAPSHOT_SYNC_UNAUTHORIZED: "SNAPSHOT_SYNC_UNAUTHORIZED";
|
|
68
|
-
readonly SNAPSHOT_SYNC_REQUEST_INVALID: "SNAPSHOT_SYNC_REQUEST_INVALID";
|
|
69
|
-
readonly SNAPSHOT_SYNC_INDEX_NOT_FOUND: "SNAPSHOT_SYNC_INDEX_NOT_FOUND";
|
|
70
|
-
readonly SNAPSHOT_SYNC_TOO_LARGE: "SNAPSHOT_SYNC_TOO_LARGE";
|
|
71
|
-
readonly SNAPSHOT_SYNC_CAPACITY_EXHAUSTED: "SNAPSHOT_SYNC_CAPACITY_EXHAUSTED";
|
|
72
|
-
readonly SNAPSHOT_SYNC_SNAPSHOT_FAILED: "SNAPSHOT_SYNC_SNAPSHOT_FAILED";
|
|
73
|
-
readonly SNAPSHOT_SYNC_DECODE_FAILED: "SNAPSHOT_SYNC_DECODE_FAILED";
|
|
74
|
-
readonly SNAPSHOT_SYNC_FRAME_INVALID: "SNAPSHOT_SYNC_FRAME_INVALID";
|
|
75
|
-
readonly SNAPSHOT_SYNC_HEADER_INVALID: "SNAPSHOT_SYNC_HEADER_INVALID";
|
|
76
|
-
readonly SNAPSHOT_SYNC_HEADER_MISMATCH: "SNAPSHOT_SYNC_HEADER_MISMATCH";
|
|
77
|
-
readonly SNAPSHOT_SYNC_CHUNK_OUT_OF_ORDER: "SNAPSHOT_SYNC_CHUNK_OUT_OF_ORDER";
|
|
78
|
-
readonly SNAPSHOT_SYNC_CHUNK_OVERFLOW: "SNAPSHOT_SYNC_CHUNK_OVERFLOW";
|
|
79
|
-
readonly SNAPSHOT_SYNC_CHUNK_SIZE_EXCEEDED: "SNAPSHOT_SYNC_CHUNK_SIZE_EXCEEDED";
|
|
80
|
-
readonly SNAPSHOT_SYNC_CHUNK_MISSING: "SNAPSHOT_SYNC_CHUNK_MISSING";
|
|
81
|
-
readonly SNAPSHOT_SYNC_END_MISSING: "SNAPSHOT_SYNC_END_MISSING";
|
|
82
|
-
readonly SNAPSHOT_SYNC_CHECKSUM_MISMATCH: "SNAPSHOT_SYNC_CHECKSUM_MISMATCH";
|
|
83
|
-
readonly SNAPSHOT_SYNC_PRIMARY_ERROR: "SNAPSHOT_SYNC_PRIMARY_ERROR";
|
|
84
|
-
readonly SNAPSHOT_SYNC_NO_TARGETS: "SNAPSHOT_SYNC_NO_TARGETS";
|
|
85
|
-
readonly SNAPSHOT_SYNC_TRANSPORT_FAILED: "SNAPSHOT_SYNC_TRANSPORT_FAILED";
|
|
86
|
-
readonly SNAPSHOT_SYNC_SCHEMA_UNAVAILABLE: "SNAPSHOT_SYNC_SCHEMA_UNAVAILABLE";
|
|
87
|
-
readonly SNAPSHOT_SYNC_RESTORE_FAILED: "SNAPSHOT_SYNC_RESTORE_FAILED";
|
|
88
|
-
readonly SNAPSHOT_SYNC_RESTORE_CLEANUP_FAILED: "SNAPSHOT_SYNC_RESTORE_CLEANUP_FAILED";
|
|
89
|
-
readonly SNAPSHOT_SYNC_TIMEOUT: "SNAPSHOT_SYNC_TIMEOUT";
|
|
90
|
-
readonly SNAPSHOT_SYNC_ALLOCATION_UNAVAILABLE: "SNAPSHOT_SYNC_ALLOCATION_UNAVAILABLE";
|
|
91
|
-
readonly SNAPSHOT_SYNC_NOT_ASSIGNED: "SNAPSHOT_SYNC_NOT_ASSIGNED";
|
|
92
|
-
readonly SNAPSHOT_SYNC_ABORTED: "SNAPSHOT_SYNC_ABORTED";
|
|
93
|
-
};
|
|
94
|
-
type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
95
|
-
declare class NarsilError extends Error {
|
|
96
|
-
readonly code: ErrorCode;
|
|
97
|
-
readonly details: Record<string, unknown>;
|
|
98
|
-
constructor(code: ErrorCode, message: string, details?: Record<string, unknown>);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
type ComparisonFilter = {
|
|
102
|
-
eq?: number | string | boolean;
|
|
103
|
-
ne?: number | string | boolean;
|
|
104
|
-
gt?: number;
|
|
105
|
-
lt?: number;
|
|
106
|
-
gte?: number;
|
|
107
|
-
lte?: number;
|
|
108
|
-
between?: [number, number];
|
|
109
|
-
};
|
|
110
|
-
type StringFilter = ComparisonFilter & {
|
|
111
|
-
in?: string[];
|
|
112
|
-
nin?: string[];
|
|
113
|
-
startsWith?: string;
|
|
114
|
-
endsWith?: string;
|
|
115
|
-
};
|
|
116
|
-
type ArrayFilter = {
|
|
117
|
-
containsAll?: (string | number | boolean)[];
|
|
118
|
-
matchesAny?: (string | number | boolean)[];
|
|
119
|
-
size?: ComparisonFilter;
|
|
120
|
-
};
|
|
121
|
-
type PresenceFilter = {
|
|
122
|
-
exists?: boolean;
|
|
123
|
-
notExists?: boolean;
|
|
124
|
-
isEmpty?: boolean;
|
|
125
|
-
isNotEmpty?: boolean;
|
|
126
|
-
};
|
|
127
|
-
type GeoRadiusFilter = {
|
|
128
|
-
radius: {
|
|
129
|
-
lat: number;
|
|
130
|
-
lon: number;
|
|
131
|
-
distance: number;
|
|
132
|
-
unit: 'km' | 'mi' | 'm';
|
|
133
|
-
inside?: boolean;
|
|
134
|
-
highPrecision?: boolean;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
type GeoPolygonFilter = {
|
|
138
|
-
polygon: {
|
|
139
|
-
points: Array<{
|
|
140
|
-
lat: number;
|
|
141
|
-
lon: number;
|
|
142
|
-
}>;
|
|
143
|
-
inside?: boolean;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
type GeoFilter = GeoRadiusFilter | GeoPolygonFilter;
|
|
147
|
-
type FieldFilter = ComparisonFilter | StringFilter | ArrayFilter | PresenceFilter | GeoFilter;
|
|
148
|
-
type FilterExpression = {
|
|
149
|
-
fields?: Record<string, FieldFilter>;
|
|
150
|
-
and?: FilterExpression[];
|
|
151
|
-
or?: FilterExpression[];
|
|
152
|
-
not?: FilterExpression;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
type SearchMode = 'fulltext' | 'vector' | 'hybrid';
|
|
156
|
-
type TermMatchPolicy = 'all' | 'any' | number;
|
|
157
|
-
interface QueryParams {
|
|
158
|
-
term?: string;
|
|
159
|
-
fields?: string[];
|
|
160
|
-
filters?: FilterExpression;
|
|
161
|
-
boost?: Record<string, number>;
|
|
162
|
-
scoring?: ScoringMode;
|
|
163
|
-
minScore?: number;
|
|
164
|
-
termMatch?: TermMatchPolicy;
|
|
165
|
-
tolerance?: number;
|
|
166
|
-
prefixLength?: number;
|
|
167
|
-
/**
|
|
168
|
-
* Treat the last query token as an unfinished word so it also matches
|
|
169
|
-
* indexed terms that complete it ("secur" matches "security"). Earlier
|
|
170
|
-
* tokens must match fully; `tolerance` keeps applying to them but not to
|
|
171
|
-
* the prefix token. Completions score against a shared document frequency
|
|
172
|
-
* and are demoted below full-word matches. Ignored when `exact` is true.
|
|
173
|
-
* Off by default.
|
|
174
|
-
*/
|
|
175
|
-
prefix?: boolean;
|
|
176
|
-
exact?: boolean;
|
|
177
|
-
facets?: FacetConfig;
|
|
178
|
-
sort?: Record<string, 'asc' | 'desc'>;
|
|
179
|
-
group?: GroupConfig;
|
|
180
|
-
limit?: number;
|
|
181
|
-
offset?: number;
|
|
182
|
-
searchAfter?: string;
|
|
183
|
-
highlight?: HighlightConfig;
|
|
184
|
-
pinned?: Array<{
|
|
185
|
-
docId: string;
|
|
186
|
-
position: number;
|
|
187
|
-
}>;
|
|
188
|
-
mode?: SearchMode;
|
|
189
|
-
vector?: VectorQueryConfig;
|
|
190
|
-
hybrid?: HybridConfig;
|
|
191
|
-
includeScoreComponents?: boolean;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Vector-search inputs passed under `QueryParams.vector`.
|
|
195
|
-
*
|
|
196
|
-
* Supply either a raw `value` array or a `text` string for auto-embedding;
|
|
197
|
-
* passing both throws `EMBEDDING_CONFIG_INVALID`. Result count is governed
|
|
198
|
-
* by the outer query's `limit`, not by any field on this object.
|
|
199
|
-
*/
|
|
200
|
-
interface VectorQueryConfig {
|
|
201
|
-
/**
|
|
202
|
-
* Name of the schema field that holds the vector to compare against.
|
|
203
|
-
* Must reference a field declared as `vector[N]` in the index schema.
|
|
204
|
-
*/
|
|
205
|
-
field: string;
|
|
206
|
-
/**
|
|
207
|
-
* Raw query vector. Length must match the indexed field's dimension or
|
|
208
|
-
* the search rejects the request with `VECTOR_DIMENSION_MISMATCH`.
|
|
209
|
-
*/
|
|
210
|
-
value?: number[];
|
|
211
|
-
/**
|
|
212
|
-
* Text to embed at query time using the index or instance embedding
|
|
213
|
-
* adapter. Mutually exclusive with `value`; requires a configured adapter.
|
|
214
|
-
*/
|
|
215
|
-
text?: string;
|
|
216
|
-
/**
|
|
217
|
-
* Score floor applied during ranking. Hits scoring below this value
|
|
218
|
-
* are dropped before `limit` is enforced, so the returned hit count
|
|
219
|
-
* can be smaller than `limit` even when more documents exist. The
|
|
220
|
-
* floor is interpreted in score space for every metric; for
|
|
221
|
-
* `euclidean`, distance is mapped to a similarity score of
|
|
222
|
-
* `1 / (1 + distance)` first. Defaults to no floor.
|
|
223
|
-
*/
|
|
224
|
-
similarity?: number;
|
|
225
|
-
/**
|
|
226
|
-
* Similarity metric used for ranking. Defaults to `cosine`. Choose
|
|
227
|
-
* `dotProduct` for raw inner-product scoring on already-normalised
|
|
228
|
-
* vectors and `euclidean` for distance-based ordering.
|
|
229
|
-
*/
|
|
230
|
-
metric?: 'cosine' | 'dotProduct' | 'euclidean';
|
|
231
|
-
/**
|
|
232
|
-
* HNSW exploration factor for approximate search. Higher values raise
|
|
233
|
-
* recall at the cost of latency. Ignored while the field is still
|
|
234
|
-
* served by the brute-force backend. Defaults to the engine's built-in
|
|
235
|
-
* value when omitted.
|
|
236
|
-
*/
|
|
237
|
-
efSearch?: number;
|
|
238
|
-
}
|
|
239
|
-
interface HybridConfig {
|
|
240
|
-
strategy?: 'rrf' | 'linear';
|
|
241
|
-
k?: number;
|
|
242
|
-
alpha?: number;
|
|
243
|
-
}
|
|
244
|
-
interface FacetConfig {
|
|
245
|
-
[field: string]: {
|
|
246
|
-
limit?: number;
|
|
247
|
-
sort?: 'asc' | 'desc';
|
|
248
|
-
ranges?: Array<{
|
|
249
|
-
from: number;
|
|
250
|
-
to: number;
|
|
251
|
-
}>;
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
interface GroupConfig {
|
|
255
|
-
fields: string[];
|
|
256
|
-
maxPerGroup?: number;
|
|
257
|
-
reduce?: GroupReducer;
|
|
258
|
-
}
|
|
259
|
-
type GroupReducer = {
|
|
260
|
-
reducer: (accumulator: unknown, doc: AnyDocument, score: number) => unknown;
|
|
261
|
-
initialValue: () => unknown;
|
|
262
|
-
};
|
|
263
|
-
interface HighlightConfig {
|
|
264
|
-
fields: string[];
|
|
265
|
-
preTag?: string;
|
|
266
|
-
postTag?: string;
|
|
267
|
-
maxSnippetLength?: number;
|
|
268
|
-
}
|
|
269
|
-
interface SuggestParams {
|
|
270
|
-
prefix: string;
|
|
271
|
-
limit?: number;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
interface QueryResult<T = AnyDocument> {
|
|
275
|
-
hits: Array<Hit<T>>;
|
|
276
|
-
count: number;
|
|
277
|
-
elapsed: number;
|
|
278
|
-
cursor?: string;
|
|
279
|
-
facets?: Record<string, FacetResult>;
|
|
280
|
-
groups?: GroupResult[];
|
|
281
|
-
analysisStale?: boolean;
|
|
282
|
-
}
|
|
283
|
-
interface Hit<T = AnyDocument> {
|
|
284
|
-
id: string;
|
|
285
|
-
score: number;
|
|
286
|
-
document: T;
|
|
287
|
-
scoreComponents?: ScoreComponents;
|
|
288
|
-
highlights?: Record<string, HighlightMatch>;
|
|
289
|
-
}
|
|
290
|
-
interface ScoreComponents {
|
|
291
|
-
termFrequencies: Record<string, number>;
|
|
292
|
-
fieldLengths: Record<string, number>;
|
|
293
|
-
idf: Record<string, number>;
|
|
294
|
-
}
|
|
295
|
-
interface HighlightMatch {
|
|
296
|
-
snippet: string;
|
|
297
|
-
positions: Array<{
|
|
298
|
-
start: number;
|
|
299
|
-
end: number;
|
|
300
|
-
}>;
|
|
301
|
-
}
|
|
302
|
-
interface FacetResult {
|
|
303
|
-
values: Record<string, number>;
|
|
304
|
-
count: number;
|
|
305
|
-
}
|
|
306
|
-
interface GroupResult {
|
|
307
|
-
values: Record<string, unknown>;
|
|
308
|
-
hits: Array<Hit>;
|
|
309
|
-
}
|
|
310
|
-
interface PreflightResult {
|
|
311
|
-
count: number;
|
|
312
|
-
elapsed: number;
|
|
313
|
-
analysisStale?: boolean;
|
|
314
|
-
}
|
|
315
|
-
interface BatchResult {
|
|
316
|
-
succeeded: string[];
|
|
317
|
-
failed: Array<{
|
|
318
|
-
docId: string;
|
|
319
|
-
error: NarsilError;
|
|
320
|
-
}>;
|
|
321
|
-
}
|
|
322
|
-
interface IndexStats {
|
|
323
|
-
documentCount: number;
|
|
324
|
-
partitionCount: number;
|
|
325
|
-
/**
|
|
326
|
-
* Formula-based estimate of the index's main-thread memory footprint, summed
|
|
327
|
-
* across every partition and vector index for this index. Computed from
|
|
328
|
-
* structural counters (document count, posting counts, field-index sizes),
|
|
329
|
-
* not measured. Per-object V8 overhead (hidden classes, map transitions,
|
|
330
|
-
* GC headers) is not captured here, so this number routinely undershoots
|
|
331
|
-
* the real heap by a meaningful factor. Use {@link Narsil.getMemoryStats}
|
|
332
|
-
* when sizing host memory.
|
|
333
|
-
*/
|
|
334
|
-
estimatedMemoryBytes: number;
|
|
335
|
-
language: string;
|
|
336
|
-
schema: SchemaDefinition;
|
|
337
|
-
}
|
|
338
|
-
interface IndexInfo {
|
|
339
|
-
name: string;
|
|
340
|
-
documentCount: number;
|
|
341
|
-
partitionCount: number;
|
|
342
|
-
language: string;
|
|
343
|
-
analysisStale?: boolean;
|
|
344
|
-
}
|
|
345
|
-
interface PartitionStatsResult {
|
|
346
|
-
partitionId: number;
|
|
347
|
-
documentCount: number;
|
|
348
|
-
/**
|
|
349
|
-
* Formula-based estimate of this partition's memory footprint. V8 has no
|
|
350
|
-
* per-object heap accounting API, so this number is derived from structural
|
|
351
|
-
* counters (document count, posting counts, field-index sizes) and does not
|
|
352
|
-
* include per-object overhead. Treat as an estimate, not a measurement.
|
|
353
|
-
*/
|
|
354
|
-
estimatedMemoryBytes: number;
|
|
355
|
-
}
|
|
356
|
-
interface SuggestResult {
|
|
357
|
-
terms: Array<{
|
|
358
|
-
term: string;
|
|
359
|
-
documentFrequency: number;
|
|
360
|
-
}>;
|
|
361
|
-
elapsed: number;
|
|
362
|
-
analysisStale?: boolean;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Snapshot of V8 heap usage as reported by `process.memoryUsage()`. All values
|
|
366
|
-
* are bytes. `null` in environments that do not expose `process.memoryUsage`,
|
|
367
|
-
* such as browsers.
|
|
368
|
-
*/
|
|
369
|
-
interface ProcessMemoryReport {
|
|
370
|
-
heapUsed: number;
|
|
371
|
-
heapTotal: number;
|
|
372
|
-
external: number;
|
|
373
|
-
rss: number;
|
|
374
|
-
}
|
|
375
|
-
interface MemoryStats {
|
|
376
|
-
/**
|
|
377
|
-
* V8 heap usage for the host process at the moment the call was made. This
|
|
378
|
-
* is process-wide, not engine-wide; if multiple Narsil engines are running
|
|
379
|
-
* in the same process every engine's `getMemoryStats` returns the same
|
|
380
|
-
* `process` figures. `null` in browsers and any runtime where
|
|
381
|
-
* `process.memoryUsage` is unavailable.
|
|
382
|
-
*/
|
|
383
|
-
process: ProcessMemoryReport | null;
|
|
384
|
-
/**
|
|
385
|
-
* Sum of every index's {@link IndexStats.estimatedMemoryBytes} held by this
|
|
386
|
-
* engine. Formula-based; treat as an estimate, not a measurement. Useful
|
|
387
|
-
* for cross-engine relative comparisons inside a single process where
|
|
388
|
-
* `process.heapUsed` cannot tell engines apart.
|
|
389
|
-
*/
|
|
390
|
-
estimatedIndexBytes: number;
|
|
391
|
-
/**
|
|
392
|
-
* Per-worker V8 heap usage when the engine has been promoted to a worker
|
|
393
|
-
* pool. Empty when no workers are active.
|
|
394
|
-
*/
|
|
395
|
-
workers: Array<{
|
|
396
|
-
workerId: number;
|
|
397
|
-
heapUsed: number;
|
|
398
|
-
heapTotal: number;
|
|
399
|
-
external: number;
|
|
400
|
-
}>;
|
|
401
|
-
}
|
|
402
|
-
interface VectorMaintenanceResult {
|
|
403
|
-
fieldName: string;
|
|
404
|
-
tombstoneRatio: number;
|
|
405
|
-
graphCount: number;
|
|
406
|
-
bufferSize: number;
|
|
407
|
-
building: boolean;
|
|
408
|
-
estimatedCompactMs: number;
|
|
409
|
-
estimatedOptimizeMs: number;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface NarsilPlugin {
|
|
413
|
-
name: string;
|
|
414
|
-
beforeInsert?(ctx: InsertContext): void | Promise<void>;
|
|
415
|
-
afterInsert?(ctx: InsertContext): void | Promise<void>;
|
|
416
|
-
beforeRemove?(ctx: RemoveContext): void | Promise<void>;
|
|
417
|
-
afterRemove?(ctx: RemoveContext): void | Promise<void>;
|
|
418
|
-
beforeUpdate?(ctx: UpdateContext): void | Promise<void>;
|
|
419
|
-
afterUpdate?(ctx: UpdateContext): void | Promise<void>;
|
|
420
|
-
beforeSearch?(ctx: SearchContext): void | Promise<void>;
|
|
421
|
-
afterSearch?(ctx: SearchContext): void | Promise<void>;
|
|
422
|
-
onIndexCreate?(ctx: IndexContext): void | Promise<void>;
|
|
423
|
-
onIndexDrop?(ctx: IndexContext): void | Promise<void>;
|
|
424
|
-
onPartitionSplit?(ctx: PartitionContext): void | Promise<void>;
|
|
425
|
-
onWorkerPromote?(ctx: WorkerContext): void | Promise<void>;
|
|
426
|
-
}
|
|
427
|
-
interface InsertContext {
|
|
428
|
-
indexName: string;
|
|
429
|
-
docId: string;
|
|
430
|
-
document: AnyDocument;
|
|
431
|
-
}
|
|
432
|
-
interface RemoveContext {
|
|
433
|
-
indexName: string;
|
|
434
|
-
docId: string;
|
|
435
|
-
}
|
|
436
|
-
interface UpdateContext {
|
|
437
|
-
indexName: string;
|
|
438
|
-
docId: string;
|
|
439
|
-
oldDocument: AnyDocument;
|
|
440
|
-
newDocument: AnyDocument;
|
|
441
|
-
}
|
|
442
|
-
interface SearchContext {
|
|
443
|
-
indexName: string;
|
|
444
|
-
params: QueryParams;
|
|
445
|
-
results?: QueryResult;
|
|
446
|
-
}
|
|
447
|
-
interface IndexContext {
|
|
448
|
-
indexName: string;
|
|
449
|
-
config: IndexConfig;
|
|
450
|
-
}
|
|
451
|
-
interface PartitionContext {
|
|
452
|
-
indexName: string;
|
|
453
|
-
oldPartitionCount: number;
|
|
454
|
-
newPartitionCount: number;
|
|
455
|
-
}
|
|
456
|
-
interface WorkerContext {
|
|
457
|
-
workerCount: number;
|
|
458
|
-
reason: string;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
interface NarsilConfig {
|
|
462
|
-
persistence?: PersistenceAdapter;
|
|
463
|
-
invalidation?: InvalidationAdapter;
|
|
464
|
-
plugins?: NarsilPlugin[];
|
|
465
|
-
idGenerator?: () => string;
|
|
466
|
-
workers?: WorkerConfig;
|
|
467
|
-
embedding?: EmbeddingAdapter;
|
|
468
|
-
/** Named adapters; names persist in index metadata so recovery can rebind. */
|
|
469
|
-
embeddingAdapters?: Record<string, EmbeddingAdapter>;
|
|
470
|
-
durability?: DurabilityConfig;
|
|
471
|
-
analysis?: AnalysisConfig;
|
|
472
|
-
}
|
|
473
|
-
interface StaleAnalysis {
|
|
474
|
-
indexName: string;
|
|
475
|
-
language: string;
|
|
476
|
-
storedRevision: string | null;
|
|
477
|
-
currentRevision: string;
|
|
478
|
-
documentCount: number;
|
|
479
|
-
}
|
|
480
|
-
interface AnalysisConfig {
|
|
481
|
-
rebuild?: 'auto' | 'manual';
|
|
482
|
-
onStaleAnalysis?(index: StaleAnalysis, rebuild: () => Promise<void>): void | Promise<void>;
|
|
483
|
-
}
|
|
484
|
-
interface DurabilityConfig {
|
|
485
|
-
tier?: 'wal' | 'snapshot';
|
|
486
|
-
directory?: string;
|
|
487
|
-
mode?: 'sync' | 'async';
|
|
488
|
-
flushIntervalMs?: number;
|
|
489
|
-
segmentMaxBytes?: number;
|
|
490
|
-
checkpointIntervalMs?: number;
|
|
491
|
-
checkpointMutationThreshold?: number;
|
|
492
|
-
compactionThreshold?: number;
|
|
493
|
-
}
|
|
494
|
-
interface WorkerConfig {
|
|
495
|
-
enabled?: boolean;
|
|
496
|
-
count?: number;
|
|
497
|
-
promotionThreshold?: number;
|
|
498
|
-
totalPromotionThreshold?: number;
|
|
499
|
-
bootstrapModule?: string;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
export { type ArrayFilter as A, type BatchResult as B, type ComparisonFilter as C, type DurabilityConfig as D, type ErrorCode as E, type FacetConfig as F, type GeoPolygonFilter as G, type HighlightConfig as H, type IndexContext as I, type WorkerContext as J, type MemoryStats as M, type NarsilConfig as N, type PartitionContext as P, type QueryParams as Q, type RemoveContext as R, type ScoreComponents as S, type TermMatchPolicy as T, type UpdateContext as U, type VectorMaintenanceResult as V, type WorkerConfig as W, ErrorCodes as a, type FacetResult as b, type FilterExpression as c, type GeoRadiusFilter as d, type GroupConfig as e, type GroupReducer as f, type GroupResult as g, type HighlightMatch as h, type Hit as i, type HybridConfig as j, type IndexInfo as k, type IndexStats as l, type InsertContext as m, NarsilError as n, type NarsilPlugin as o, type PartitionStatsResult as p, type PreflightResult as q, type PresenceFilter as r, type ProcessMemoryReport as s, type QueryResult as t, type SearchContext as u, type SearchMode as v, type StringFilter as w, type SuggestParams as x, type SuggestResult as y, type VectorQueryConfig as z };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface LanguageModule {
|
|
2
|
-
name: string;
|
|
3
|
-
revision: string;
|
|
4
|
-
stemmer: ((token: string) => string) | null;
|
|
5
|
-
stopWords: Set<string>;
|
|
6
|
-
normalizer?: (token: string) => string;
|
|
7
|
-
tokenizer?: TokenizerConfig;
|
|
8
|
-
}
|
|
9
|
-
interface TokenizerConfig {
|
|
10
|
-
splitPattern?: RegExp;
|
|
11
|
-
normalizeDiacritics?: boolean;
|
|
12
|
-
minTokenLength?: number;
|
|
13
|
-
stripPossessive?: boolean;
|
|
14
|
-
ngramSize?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type { LanguageModule as L, TokenizerConfig as T };
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { I as IndexConfig, A as AnyDocument, a as InsertOptions, P as PartitionConfig } from './schema-BnvLvjRp.js';
|
|
2
|
-
import { k as IndexInfo, l as IndexStats, p as PartitionStatsResult, B as BatchResult, Q as QueryParams, t as QueryResult, q as PreflightResult, x as SuggestParams, y as SuggestResult, M as MemoryStats, V as VectorMaintenanceResult, N as NarsilConfig } from './config-P27AtSn4.js';
|
|
3
|
-
import { E as EmbeddingAdapter } from './adapters-Bo2JQg8b.js';
|
|
4
|
-
|
|
5
|
-
type NarsilEventMap = {
|
|
6
|
-
persistenceError: {
|
|
7
|
-
indexName: string;
|
|
8
|
-
partitionId: number;
|
|
9
|
-
error: Error;
|
|
10
|
-
retriesExhausted: boolean;
|
|
11
|
-
};
|
|
12
|
-
workerCrash: {
|
|
13
|
-
workerId: number;
|
|
14
|
-
indexNames: string[];
|
|
15
|
-
error: Error;
|
|
16
|
-
};
|
|
17
|
-
workerPromote: {
|
|
18
|
-
workerCount: number;
|
|
19
|
-
reason: string;
|
|
20
|
-
};
|
|
21
|
-
workerPromoteFailure: {
|
|
22
|
-
reason: string;
|
|
23
|
-
error: Error;
|
|
24
|
-
retryable: boolean;
|
|
25
|
-
};
|
|
26
|
-
partitionRebalance: {
|
|
27
|
-
indexName: string;
|
|
28
|
-
oldCount: number;
|
|
29
|
-
newCount: number;
|
|
30
|
-
};
|
|
31
|
-
partitionWatermark: {
|
|
32
|
-
indexName: string;
|
|
33
|
-
documentCount: number;
|
|
34
|
-
capacity: number;
|
|
35
|
-
partitionCount: number;
|
|
36
|
-
};
|
|
37
|
-
analysisRebuild: {
|
|
38
|
-
indexName: string;
|
|
39
|
-
status: 'started' | 'completed' | 'failed';
|
|
40
|
-
partitionsRebuilt: number;
|
|
41
|
-
partitionCount: number;
|
|
42
|
-
error?: Error;
|
|
43
|
-
};
|
|
44
|
-
durabilityError: {
|
|
45
|
-
error: Error;
|
|
46
|
-
};
|
|
47
|
-
invalidationError: {
|
|
48
|
-
error: Error;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
interface Narsil {
|
|
53
|
-
/**
|
|
54
|
-
* Creates an index you can insert documents into and query.
|
|
55
|
-
*
|
|
56
|
-
* The schema sets the type of each field, decides which fields you can
|
|
57
|
-
* filter and sort on, and controls how the engine tokenises text. The
|
|
58
|
-
* `language` option picks the analyser that stems those text fields.
|
|
59
|
-
*
|
|
60
|
-
* @param name - Every later call uses this name to reach the index.
|
|
61
|
-
* @param config - This carries the schema, and the language, partitioning,
|
|
62
|
-
* and scoring settings.
|
|
63
|
-
*/
|
|
64
|
-
createIndex(name: string, config: IndexConfig): Promise<void>;
|
|
65
|
-
/** Registers an adapter under a name that index configs can reference and
|
|
66
|
-
* durability metadata can persist; re-registering rebinds referencing indexes. */
|
|
67
|
-
registerEmbeddingAdapter(name: string, adapter: EmbeddingAdapter): void;
|
|
68
|
-
dropIndex(name: string): Promise<void>;
|
|
69
|
-
listIndexes(): IndexInfo[];
|
|
70
|
-
getStats(indexName: string): IndexStats;
|
|
71
|
-
getPartitionStats(indexName: string): PartitionStatsResult[];
|
|
72
|
-
/**
|
|
73
|
-
* Adds one document to an index and returns the id it is stored under.
|
|
74
|
-
*
|
|
75
|
-
* The id comes from the `docId` argument when you pass one, otherwise from
|
|
76
|
-
* the document's own `id` field, and otherwise the engine generates it. Use
|
|
77
|
-
* {@link Narsil.insertBatch} for a large load, so that one bad document
|
|
78
|
-
* cannot abandon the rest.
|
|
79
|
-
*
|
|
80
|
-
* @param indexName - The index that receives the document.
|
|
81
|
-
* @param document - Its fields must match the types the schema declares.
|
|
82
|
-
* @param docId - Pass an id to control it yourself, or omit it and read the
|
|
83
|
-
* returned value.
|
|
84
|
-
* @returns The id the document is stored under.
|
|
85
|
-
*/
|
|
86
|
-
insert(indexName: string, document: AnyDocument, docId?: string, options?: InsertOptions): Promise<string>;
|
|
87
|
-
insertBatch(indexName: string, documents: AnyDocument[], options?: InsertOptions): Promise<BatchResult>;
|
|
88
|
-
remove(indexName: string, docId: string): Promise<void>;
|
|
89
|
-
removeBatch(indexName: string, docIds: string[]): Promise<BatchResult>;
|
|
90
|
-
update(indexName: string, docId: string, document: AnyDocument): Promise<void>;
|
|
91
|
-
updateBatch(indexName: string, updates: Array<{
|
|
92
|
-
docId: string;
|
|
93
|
-
document: AnyDocument;
|
|
94
|
-
}>): Promise<BatchResult>;
|
|
95
|
-
get(indexName: string, docId: string): Promise<AnyDocument | undefined>;
|
|
96
|
-
getMultiple(indexName: string, docIds: string[]): Promise<Map<string, AnyDocument>>;
|
|
97
|
-
has(indexName: string, docId: string): Promise<boolean>;
|
|
98
|
-
countDocuments(indexName: string): Promise<number>;
|
|
99
|
-
/**
|
|
100
|
-
* Runs a search against an index and returns the ranked hits.
|
|
101
|
-
*
|
|
102
|
-
* One call covers keyword search, vector search, and a hybrid of the two,
|
|
103
|
-
* chosen by the `mode` parameter. BM25 ranks keyword results by default.
|
|
104
|
-
* Every hit carries its score and its document, along with highlights when
|
|
105
|
-
* you ask for them.
|
|
106
|
-
*
|
|
107
|
-
* @param indexName - The index the search runs against.
|
|
108
|
-
* @param params - These set the search term, filters, field boosts, sorting,
|
|
109
|
-
* facets, highlighting, and the result limit.
|
|
110
|
-
* @returns The hits, the total count, the elapsed time, and any facets or
|
|
111
|
-
* groups the query asked for.
|
|
112
|
-
*/
|
|
113
|
-
query<T = AnyDocument>(indexName: string, params: QueryParams): Promise<QueryResult<T>>;
|
|
114
|
-
preflight(indexName: string, params: QueryParams): Promise<PreflightResult>;
|
|
115
|
-
suggest(indexName: string, params: SuggestParams): Promise<SuggestResult>;
|
|
116
|
-
/**
|
|
117
|
-
* Rebuilds an index's terms from the documents it already stores, and
|
|
118
|
-
* resolves once every partition carries terms the current language module
|
|
119
|
-
* produced.
|
|
120
|
-
*
|
|
121
|
-
* An index whose stored analysis revision differs from the one its language
|
|
122
|
-
* module carries answers text queries from terms an earlier analysis wrote,
|
|
123
|
-
* and every such result reports `analysisStale`. Call this after the engine
|
|
124
|
-
* reports a stale index to configuration that declined an automatic rebuild.
|
|
125
|
-
* Calling it for an index whose terms are current does nothing.
|
|
126
|
-
*
|
|
127
|
-
* @param indexName - The index whose terms are rebuilt.
|
|
128
|
-
*/
|
|
129
|
-
rebuildAnalysis(indexName: string): Promise<void>;
|
|
130
|
-
snapshot(indexName: string): Promise<Uint8Array>;
|
|
131
|
-
restore(indexName: string, data: Uint8Array): Promise<void>;
|
|
132
|
-
checkpoint(indexName: string): Promise<void>;
|
|
133
|
-
clear(indexName: string): Promise<void>;
|
|
134
|
-
rebalance(indexName: string, targetPartitionCount: number): Promise<void>;
|
|
135
|
-
updatePartitionConfig(indexName: string, config: Partial<PartitionConfig>): Promise<void>;
|
|
136
|
-
getMemoryStats(): Promise<MemoryStats>;
|
|
137
|
-
compactVectors(indexName: string, fieldName?: string): Promise<void>;
|
|
138
|
-
optimizeVectors(indexName: string, fieldName?: string): Promise<void>;
|
|
139
|
-
vectorMaintenanceStatus(indexName: string): VectorMaintenanceResult[];
|
|
140
|
-
on<K extends keyof NarsilEventMap>(event: K, handler: (payload: NarsilEventMap[K]) => void): void;
|
|
141
|
-
off<K extends keyof NarsilEventMap>(event: K, handler: (payload: NarsilEventMap[K]) => void): void;
|
|
142
|
-
shutdown(): Promise<void>;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Creates a search engine that runs inside your process, with no server to
|
|
146
|
-
* provision.
|
|
147
|
-
*
|
|
148
|
-
* The engine holds every index you create, so an application usually keeps one
|
|
149
|
-
* instance for its lifetime. When you configure persistence, this recovers the
|
|
150
|
-
* indexes already on disk before it resolves, so the engine is ready to query
|
|
151
|
-
* as soon as you have it.
|
|
152
|
-
*
|
|
153
|
-
* @param config - This carries the persistence, partitioning, and worker
|
|
154
|
-
* invalidation settings. Omit it for an engine that keeps everything in memory.
|
|
155
|
-
* @returns The engine, ready for {@link Narsil.createIndex} to run against.
|
|
156
|
-
*/
|
|
157
|
-
declare function createNarsil(config?: NarsilConfig): Promise<Narsil>;
|
|
158
|
-
|
|
159
|
-
export { type Narsil as N, type NarsilEventMap as a, createNarsil as c };
|