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