@omendb/omendb 0.0.19 → 0.0.20
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/index.d.ts +271 -245
- package/index.js +152 -1
- package/package.json +6 -6
package/index.d.ts
CHANGED
|
@@ -1,207 +1,229 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export declare class VectorDatabase {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Insert or update vectors.
|
|
6
|
+
*
|
|
7
|
+
* Accepts an array of items with id, vector, and optional metadata.
|
|
8
|
+
*/
|
|
9
|
+
set(items: Array<VectorItem>): Array<number>;
|
|
10
|
+
/**
|
|
11
|
+
* Search for k nearest neighbors.
|
|
12
|
+
*
|
|
13
|
+
* @param query - Query vector (number[] or Float32Array)
|
|
14
|
+
* @param k - Number of results to return
|
|
15
|
+
* @param ef - Optional search width override
|
|
16
|
+
* @param filter - Optional metadata filter (e.g., {category: "foo"} or {price: {$gt: 10}})
|
|
17
|
+
* @param maxDistance - Optional max distance threshold (filter out distant results)
|
|
18
|
+
* @returns Array of {id, distance, metadata}
|
|
19
|
+
*/
|
|
20
|
+
search(
|
|
21
|
+
query: Array<number> | Float32Array,
|
|
22
|
+
k: number,
|
|
23
|
+
ef?: number | undefined | null,
|
|
24
|
+
filter?: Record<string, unknown> | undefined,
|
|
25
|
+
maxDistance?: number | undefined | null,
|
|
26
|
+
): Array<SearchResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Batch search with parallel execution (async).
|
|
29
|
+
*
|
|
30
|
+
* Runs searches in parallel using rayon, returns Promise.
|
|
31
|
+
*/
|
|
32
|
+
searchBatch(
|
|
33
|
+
queries: Array<Array<number> | Float32Array>,
|
|
34
|
+
k: number,
|
|
35
|
+
ef?: number | undefined | null,
|
|
36
|
+
): Promise<Array<Array<SearchResult>>>;
|
|
37
|
+
/** Get a vector by ID. */
|
|
38
|
+
get(id: string): GetResult | null;
|
|
39
|
+
/**
|
|
40
|
+
* Delete vectors by ID.
|
|
41
|
+
*
|
|
42
|
+
* @returns Number of vectors deleted
|
|
43
|
+
*/
|
|
44
|
+
delete(ids: Array<string>): number;
|
|
45
|
+
/**
|
|
46
|
+
* Delete vectors matching a metadata filter.
|
|
47
|
+
*
|
|
48
|
+
* Evaluates the filter against all vectors and deletes those that match.
|
|
49
|
+
* Uses the same MongoDB-style filter syntax as search().
|
|
50
|
+
*
|
|
51
|
+
* @param filter - MongoDB-style metadata filter
|
|
52
|
+
* @returns Number of vectors deleted
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```javascript
|
|
56
|
+
* // Delete by equality
|
|
57
|
+
* db.deleteWhere({ status: "archived" });
|
|
58
|
+
*
|
|
59
|
+
* // Delete with comparison
|
|
60
|
+
* db.deleteWhere({ score: { $lt: 0.5 } });
|
|
61
|
+
*
|
|
62
|
+
* // Complex filter
|
|
63
|
+
* db.deleteWhere({ $and: [{ type: "draft" }, { age: { $gt: 30 } }] });
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
deleteWhere(filter: Record<string, unknown>): number;
|
|
67
|
+
/**
|
|
68
|
+
* Count vectors, optionally filtered by metadata.
|
|
69
|
+
*
|
|
70
|
+
* Without a filter, returns total count (same as db.length).
|
|
71
|
+
* With a filter, returns count of vectors matching the filter.
|
|
72
|
+
*
|
|
73
|
+
* @param filter - Optional MongoDB-style metadata filter
|
|
74
|
+
* @returns Number of vectors (matching filter if provided)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```javascript
|
|
78
|
+
* // Total count
|
|
79
|
+
* const total = db.count();
|
|
80
|
+
*
|
|
81
|
+
* // Filtered count
|
|
82
|
+
* const active = db.count({ status: "active" });
|
|
83
|
+
*
|
|
84
|
+
* // With comparison operators
|
|
85
|
+
* const highScore = db.count({ score: { $gte: 0.8 } });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
count(filter?: Record<string, unknown> | undefined): number;
|
|
89
|
+
/** Update a vector's data and/or metadata. */
|
|
90
|
+
update(
|
|
91
|
+
id: string,
|
|
92
|
+
vector: Array<number> | Float32Array,
|
|
93
|
+
metadata?: Record<string, unknown> | undefined,
|
|
94
|
+
): void;
|
|
95
|
+
/** Get number of vectors in database. */
|
|
96
|
+
get length(): number;
|
|
97
|
+
/** Get vector dimensions of this database. */
|
|
98
|
+
get dimensions(): number;
|
|
99
|
+
/** Check if database is empty. */
|
|
100
|
+
isEmpty(): boolean;
|
|
101
|
+
/** Get database statistics. */
|
|
102
|
+
stats(): StatsResult;
|
|
103
|
+
/** Get current ef_search value. */
|
|
104
|
+
get efSearch(): number;
|
|
105
|
+
/** Set ef_search value. */
|
|
106
|
+
set efSearch(efSearch: number);
|
|
107
|
+
/**
|
|
108
|
+
* Get or create a named collection.
|
|
109
|
+
*
|
|
110
|
+
* Collection handles share state - changes made through one handle
|
|
111
|
+
* are immediately visible through another (no flush required).
|
|
112
|
+
*/
|
|
113
|
+
collection(name: string): VectorDatabase;
|
|
114
|
+
/** List all collections. */
|
|
115
|
+
collections(): Array<string>;
|
|
116
|
+
/** Delete a collection. */
|
|
117
|
+
deleteCollection(name: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Enable text search for hybrid (vector + text) search.
|
|
120
|
+
*
|
|
121
|
+
* Must be called before using setWithText() or hybridSearch().
|
|
122
|
+
*/
|
|
123
|
+
enableTextSearch(): void;
|
|
124
|
+
/** Check if text search is enabled. */
|
|
125
|
+
get hasTextSearch(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Set vectors with associated text for hybrid search.
|
|
128
|
+
*
|
|
129
|
+
* @param items - Array of {id, vector, text, metadata?}
|
|
130
|
+
* @returns Array of internal indices
|
|
131
|
+
*/
|
|
132
|
+
setWithText(items: Array<VectorItemWithText>): Array<number>;
|
|
133
|
+
/**
|
|
134
|
+
* Search using text only (BM25 scoring).
|
|
135
|
+
*
|
|
136
|
+
* @param query - Text query
|
|
137
|
+
* @param k - Number of results
|
|
138
|
+
* @returns Array of {id, score, metadata}
|
|
139
|
+
*/
|
|
140
|
+
textSearch(query: string, k: number): Array<TextSearchResult>;
|
|
141
|
+
/**
|
|
142
|
+
* Hybrid search combining vector similarity and text relevance.
|
|
143
|
+
*
|
|
144
|
+
* Uses Reciprocal Rank Fusion (RRF) to combine HNSW and BM25 results.
|
|
145
|
+
*
|
|
146
|
+
* @param queryVector - Query embedding
|
|
147
|
+
* @param queryText - Text query for BM25
|
|
148
|
+
* @param k - Number of results
|
|
149
|
+
* @param filter - Optional metadata filter
|
|
150
|
+
* @param alpha - Weight for vector vs text (0.0=text only, 1.0=vector only, default=0.5)
|
|
151
|
+
* @param rrfK - RRF constant (default=60, higher reduces rank influence)
|
|
152
|
+
* @param subscores - Return separate keyword_score and semantic_score (default: false)
|
|
153
|
+
* @returns Array of {id, score, metadata, keyword_score?, semantic_score?}
|
|
154
|
+
*/
|
|
155
|
+
hybridSearch(
|
|
156
|
+
queryVector: Array<number> | Float32Array,
|
|
157
|
+
queryText: string,
|
|
158
|
+
k: number,
|
|
159
|
+
filter?: Record<string, unknown> | undefined,
|
|
160
|
+
alpha?: number | undefined | null,
|
|
161
|
+
rrfK?: number | undefined | null,
|
|
162
|
+
subscores?: boolean | undefined | null,
|
|
163
|
+
): Array<HybridSearchResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Flush pending changes to disk.
|
|
166
|
+
*
|
|
167
|
+
* For hybrid search, this commits text index changes.
|
|
168
|
+
*/
|
|
169
|
+
flush(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Optimize index for cache-efficient search.
|
|
172
|
+
*
|
|
173
|
+
* Reorders nodes for better memory locality, improving search performance by 6-40%.
|
|
174
|
+
* Call after inserting a large batch of vectors.
|
|
175
|
+
*
|
|
176
|
+
* @returns Number of nodes reordered
|
|
177
|
+
*/
|
|
178
|
+
optimize(): number;
|
|
179
|
+
/** Merge another database into this one. */
|
|
180
|
+
mergeFrom(other: VectorDatabase): number;
|
|
181
|
+
/**
|
|
182
|
+
* List all vector IDs (without loading vector data).
|
|
183
|
+
*
|
|
184
|
+
* Efficient way to get all IDs for iteration, export, or debugging.
|
|
185
|
+
* @returns Array of all vector IDs in the database
|
|
186
|
+
*/
|
|
187
|
+
ids(): Array<string>;
|
|
188
|
+
/**
|
|
189
|
+
* Get all items as array of {id, vector, metadata}.
|
|
190
|
+
*
|
|
191
|
+
* Returns all vectors with their IDs and metadata.
|
|
192
|
+
* For large datasets, consider using ids() and get() in batches.
|
|
193
|
+
*/
|
|
194
|
+
items(): Array<GetResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Check if an ID exists in the database.
|
|
197
|
+
*
|
|
198
|
+
* @param id - Vector ID to check
|
|
199
|
+
* @returns true if ID exists and is not deleted
|
|
200
|
+
*/
|
|
201
|
+
exists(id: string): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Get multiple vectors by ID.
|
|
204
|
+
*
|
|
205
|
+
* Batch version of get(). More efficient than calling get() in a loop.
|
|
206
|
+
*
|
|
207
|
+
* @param ids - Array of vector IDs to retrieve
|
|
208
|
+
* @returns Array of results in same order as input, null for missing IDs
|
|
209
|
+
*/
|
|
210
|
+
getMany(ids: Array<string>): Array<GetResult | undefined | null>;
|
|
189
211
|
}
|
|
190
212
|
|
|
191
213
|
export interface GetResult {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
214
|
+
id: string;
|
|
215
|
+
vector: Float32Array;
|
|
216
|
+
metadata: Record<string, unknown>;
|
|
195
217
|
}
|
|
196
218
|
|
|
197
219
|
export interface HybridSearchResult {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
220
|
+
id: string;
|
|
221
|
+
score: number;
|
|
222
|
+
metadata: Record<string, unknown>;
|
|
223
|
+
/** BM25 keyword matching score (null if document only matched vector search) */
|
|
224
|
+
keywordScore?: number;
|
|
225
|
+
/** Vector similarity score (null if document only matched text search) */
|
|
226
|
+
semanticScore?: number;
|
|
205
227
|
}
|
|
206
228
|
|
|
207
229
|
/**
|
|
@@ -239,7 +261,10 @@ export interface HybridSearchResult {
|
|
|
239
261
|
* });
|
|
240
262
|
* ```
|
|
241
263
|
*/
|
|
242
|
-
export declare function open(
|
|
264
|
+
export declare function open(
|
|
265
|
+
path: string,
|
|
266
|
+
options?: OpenOptions | undefined | null,
|
|
267
|
+
): VectorDatabase;
|
|
243
268
|
|
|
244
269
|
/**
|
|
245
270
|
* Configuration options for opening a vector database.
|
|
@@ -255,68 +280,69 @@ export declare function open(path: string, options?: OpenOptions | undefined | n
|
|
|
255
280
|
* - metric: "l2" (distance metric: "l2", "euclidean", "cosine", "dot", "ip")
|
|
256
281
|
*/
|
|
257
282
|
export interface OpenOptions {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
283
|
+
/** Vector dimensions (default: 128, auto-detected on first insert) */
|
|
284
|
+
dimensions?: number;
|
|
285
|
+
/** HNSW M parameter: neighbors per node (default: 16, range: 4-64) */
|
|
286
|
+
m?: number;
|
|
287
|
+
/** HNSW ef_construction: build quality (default: 100, must be >= m) */
|
|
288
|
+
efConstruction?: number;
|
|
289
|
+
/** HNSW ef_search: search quality/speed tradeoff (default: 100) */
|
|
290
|
+
efSearch?: number;
|
|
291
|
+
/**
|
|
292
|
+
* Quantization mode (default: null = no quantization)
|
|
293
|
+
* - true or "sq8": SQ8 4x compression, ~99% recall (RECOMMENDED)
|
|
294
|
+
* - "rabitq": RaBitQ 8x compression, ~98% recall
|
|
295
|
+
* - "binary": Binary 32x compression, ~95% recall
|
|
296
|
+
* - 2, 4, 8: RaBitQ with specific bits (legacy)
|
|
297
|
+
*/
|
|
298
|
+
quantization?: boolean | string | number | null | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Rescore candidates with exact distance (default: true when quantization enabled)
|
|
301
|
+
* Set to false for maximum speed at the cost of ~20% recall
|
|
302
|
+
*/
|
|
303
|
+
rescore?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Oversampling factor for rescoring (default: 3.0)
|
|
306
|
+
* Fetches k*oversample candidates then reranks to return top k
|
|
307
|
+
*/
|
|
308
|
+
oversample?: number;
|
|
309
|
+
/** Distance metric: "l2"/"euclidean" (default), "cosine", "dot"/"ip" */
|
|
310
|
+
metric?: string;
|
|
286
311
|
}
|
|
287
312
|
|
|
288
313
|
export interface SearchResult {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
314
|
+
id: string;
|
|
315
|
+
distance: number;
|
|
316
|
+
/** Metadata as JSON (using serde-json feature) */
|
|
317
|
+
metadata: Record<string, unknown>;
|
|
293
318
|
}
|
|
294
319
|
|
|
295
320
|
export interface StatsResult {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
321
|
+
dimensions: number;
|
|
322
|
+
count: number;
|
|
323
|
+
path: string;
|
|
299
324
|
}
|
|
300
325
|
|
|
301
326
|
export interface TextSearchResult {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
327
|
+
id: string;
|
|
328
|
+
score: number;
|
|
329
|
+
metadata: Record<string, unknown>;
|
|
305
330
|
}
|
|
306
331
|
|
|
307
332
|
export interface VectorItem {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
333
|
+
id: string;
|
|
334
|
+
/** Vector data as number[] or Float32Array (Float32Array is more efficient) */
|
|
335
|
+
vector: number[] | Float32Array;
|
|
336
|
+
/** Optional metadata */
|
|
337
|
+
metadata?: Record<string, unknown> | undefined;
|
|
338
|
+
/** Optional document text (stored in metadata.document) */
|
|
339
|
+
document?: string;
|
|
315
340
|
}
|
|
316
341
|
|
|
317
342
|
export interface VectorItemWithText {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
343
|
+
id: string;
|
|
344
|
+
/** Vector data as number[] or Float32Array (Float32Array is more efficient) */
|
|
345
|
+
vector: number[] | Float32Array;
|
|
346
|
+
text: string;
|
|
347
|
+
metadata?: Record<string, unknown> | undefined;
|
|
322
348
|
}
|
package/index.js
CHANGED
|
@@ -101,7 +101,158 @@ if (!nativeBinding) {
|
|
|
101
101
|
throw new Error(`Failed to load native binding`);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
// Convert array to Float32Array if needed
|
|
105
|
+
function toFloat32Array(arr) {
|
|
106
|
+
if (arr instanceof Float32Array) {
|
|
107
|
+
return arr;
|
|
108
|
+
}
|
|
109
|
+
return new Float32Array(arr);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Convert VectorItem to use Float32Array
|
|
113
|
+
function convertVectorItem(item) {
|
|
114
|
+
return {
|
|
115
|
+
...item,
|
|
116
|
+
vector: toFloat32Array(item.vector),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Wrap VectorDatabase to handle array conversion
|
|
121
|
+
const NativeVectorDatabase = nativeBinding.VectorDatabase;
|
|
122
|
+
|
|
123
|
+
class VectorDatabase {
|
|
124
|
+
constructor(nativeDb) {
|
|
125
|
+
this._native = nativeDb;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
set(items) {
|
|
129
|
+
return this._native.set(items.map(convertVectorItem));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
search(query, k, ef, filter, maxDistance) {
|
|
133
|
+
return this._native.search(query, k, ef, filter, maxDistance);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
searchBatch(queries, k, ef) {
|
|
137
|
+
return this._native.searchBatch(queries, k, ef);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
get(id) {
|
|
141
|
+
return this._native.get(id);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
delete(ids) {
|
|
145
|
+
return this._native.delete(ids);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
deleteWhere(filter) {
|
|
149
|
+
return this._native.deleteWhere(filter);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
count(filter) {
|
|
153
|
+
return this._native.count(filter);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
update(id, vector, metadata) {
|
|
157
|
+
return this._native.update(id, vector, metadata);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get length() {
|
|
161
|
+
return this._native.length;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
get dimensions() {
|
|
165
|
+
return this._native.dimensions;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
isEmpty() {
|
|
169
|
+
return this._native.isEmpty();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
stats() {
|
|
173
|
+
return this._native.stats();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get efSearch() {
|
|
177
|
+
return this._native.efSearch;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
set efSearch(value) {
|
|
181
|
+
this._native.efSearch = value;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
collection(name) {
|
|
185
|
+
return new VectorDatabase(this._native.collection(name));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
collections() {
|
|
189
|
+
return this._native.collections();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
deleteCollection(name) {
|
|
193
|
+
return this._native.deleteCollection(name);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
enableTextSearch() {
|
|
197
|
+
return this._native.enableTextSearch();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
get hasTextSearch() {
|
|
201
|
+
return this._native.hasTextSearch;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
setWithText(items) {
|
|
205
|
+
return this._native.setWithText(items.map(convertVectorItem));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
textSearch(query, k) {
|
|
209
|
+
return this._native.textSearch(query, k);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
hybridSearch(queryVector, queryText, k, filter, alpha, rrfK, subscores) {
|
|
213
|
+
return this._native.hybridSearch(
|
|
214
|
+
queryVector,
|
|
215
|
+
queryText,
|
|
216
|
+
k,
|
|
217
|
+
filter,
|
|
218
|
+
alpha,
|
|
219
|
+
rrfK,
|
|
220
|
+
subscores,
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
flush() {
|
|
225
|
+
return this._native.flush();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
optimize() {
|
|
229
|
+
return this._native.optimize();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
mergeFrom(other) {
|
|
233
|
+
return this._native.mergeFrom(other._native);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
ids() {
|
|
237
|
+
return this._native.ids();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
items() {
|
|
241
|
+
return this._native.items();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
exists(id) {
|
|
245
|
+
return this._native.exists(id);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
getMany(ids) {
|
|
249
|
+
return this._native.getMany(ids);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function open(path, options) {
|
|
254
|
+
return new VectorDatabase(nativeBinding.open(path, options));
|
|
255
|
+
}
|
|
105
256
|
|
|
106
257
|
module.exports.VectorDatabase = VectorDatabase;
|
|
107
258
|
module.exports.open = open;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omendb/omendb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Fast embedded vector database with HNSW + ACORN-1 filtered search",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"omendb.node"
|
|
51
51
|
],
|
|
52
52
|
"optionalDependencies": {
|
|
53
|
-
"@omendb/omendb-darwin-x64": "0.0.
|
|
54
|
-
"@omendb/omendb-darwin-arm64": "0.0.
|
|
55
|
-
"@omendb/omendb-linux-x64-gnu": "0.0.
|
|
56
|
-
"@omendb/omendb-linux-arm64-gnu": "0.0.
|
|
57
|
-
"@omendb/omendb-win32-x64-msvc": "0.0.
|
|
53
|
+
"@omendb/omendb-darwin-x64": "0.0.20",
|
|
54
|
+
"@omendb/omendb-darwin-arm64": "0.0.20",
|
|
55
|
+
"@omendb/omendb-linux-x64-gnu": "0.0.20",
|
|
56
|
+
"@omendb/omendb-linux-arm64-gnu": "0.0.20",
|
|
57
|
+
"@omendb/omendb-win32-x64-msvc": "0.0.20"
|
|
58
58
|
}
|
|
59
59
|
}
|