@omendb/omendb 0.0.10 → 0.0.12
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 +78 -1
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -31,10 +31,54 @@ export declare class VectorDatabase {
|
|
|
31
31
|
* @returns Number of vectors deleted
|
|
32
32
|
*/
|
|
33
33
|
delete(ids: Array<string>): number
|
|
34
|
+
/**
|
|
35
|
+
* Delete vectors matching a metadata filter.
|
|
36
|
+
*
|
|
37
|
+
* Evaluates the filter against all vectors and deletes those that match.
|
|
38
|
+
* Uses the same MongoDB-style filter syntax as search().
|
|
39
|
+
*
|
|
40
|
+
* @param filter - MongoDB-style metadata filter
|
|
41
|
+
* @returns Number of vectors deleted
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* // Delete by equality
|
|
46
|
+
* db.deleteWhere({ status: "archived" });
|
|
47
|
+
*
|
|
48
|
+
* // Delete with comparison
|
|
49
|
+
* db.deleteWhere({ score: { $lt: 0.5 } });
|
|
50
|
+
*
|
|
51
|
+
* // Complex filter
|
|
52
|
+
* db.deleteWhere({ $and: [{ type: "draft" }, { age: { $gt: 30 } }] });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
deleteWhere(filter: Record<string, unknown>): number
|
|
56
|
+
/**
|
|
57
|
+
* Count vectors, optionally filtered by metadata.
|
|
58
|
+
*
|
|
59
|
+
* Without a filter, returns total count (same as db.length).
|
|
60
|
+
* With a filter, returns count of vectors matching the filter.
|
|
61
|
+
*
|
|
62
|
+
* @param filter - Optional MongoDB-style metadata filter
|
|
63
|
+
* @returns Number of vectors (matching filter if provided)
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```javascript
|
|
67
|
+
* // Total count
|
|
68
|
+
* const total = db.count();
|
|
69
|
+
*
|
|
70
|
+
* // Filtered count
|
|
71
|
+
* const active = db.count({ status: "active" });
|
|
72
|
+
*
|
|
73
|
+
* // With comparison operators
|
|
74
|
+
* const highScore = db.count({ score: { $gte: 0.8 } });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
count(filter?: Record<string, unknown> | undefined): number
|
|
34
78
|
/** Update a vector's data and/or metadata. */
|
|
35
79
|
update(id: string, vector: Array<number> | Float32Array, metadata?: Record<string, unknown> | undefined): void
|
|
36
80
|
/** Get number of vectors in database. */
|
|
37
|
-
get
|
|
81
|
+
get length(): number
|
|
38
82
|
/** Get current ef_search value. */
|
|
39
83
|
get efSearch(): number
|
|
40
84
|
/** Set ef_search value. */
|
|
@@ -95,6 +139,36 @@ export declare class VectorDatabase {
|
|
|
95
139
|
flush(): void
|
|
96
140
|
/** Merge another database into this one. */
|
|
97
141
|
mergeFrom(other: VectorDatabase): number
|
|
142
|
+
/**
|
|
143
|
+
* List all vector IDs (without loading vector data).
|
|
144
|
+
*
|
|
145
|
+
* Efficient way to get all IDs for iteration, export, or debugging.
|
|
146
|
+
* @returns Array of all vector IDs in the database
|
|
147
|
+
*/
|
|
148
|
+
ids(): Array<string>
|
|
149
|
+
/**
|
|
150
|
+
* Get all items as array of {id, vector, metadata}.
|
|
151
|
+
*
|
|
152
|
+
* Returns all vectors with their IDs and metadata.
|
|
153
|
+
* For large datasets, consider using ids() and get() in batches.
|
|
154
|
+
*/
|
|
155
|
+
items(): Array<GetResult>
|
|
156
|
+
/**
|
|
157
|
+
* Check if an ID exists in the database.
|
|
158
|
+
*
|
|
159
|
+
* @param id - Vector ID to check
|
|
160
|
+
* @returns true if ID exists and is not deleted
|
|
161
|
+
*/
|
|
162
|
+
exists(id: string): boolean
|
|
163
|
+
/**
|
|
164
|
+
* Get multiple vectors by ID.
|
|
165
|
+
*
|
|
166
|
+
* Batch version of get(). More efficient than calling get() in a loop.
|
|
167
|
+
*
|
|
168
|
+
* @param ids - Array of vector IDs to retrieve
|
|
169
|
+
* @returns Array of results in same order as input, null for missing IDs
|
|
170
|
+
*/
|
|
171
|
+
getMany(ids: Array<string>): Array<GetResult | undefined | null>
|
|
98
172
|
}
|
|
99
173
|
|
|
100
174
|
export interface GetResult {
|
|
@@ -151,6 +225,7 @@ export declare function open(path: string, options?: OpenOptions | undefined | n
|
|
|
151
225
|
* - quantization: null (RaBitQ bit width: 2, 4, or 8 for compression)
|
|
152
226
|
* - rescore: true when quantization enabled (rerank candidates with exact distance)
|
|
153
227
|
* - oversample: 3.0 (fetch k*oversample candidates when rescoring)
|
|
228
|
+
* - metric: "l2" (distance metric: "l2", "euclidean", "cosine", "dot", "ip")
|
|
154
229
|
*/
|
|
155
230
|
export interface OpenOptions {
|
|
156
231
|
/** Vector dimensions (default: 128, auto-detected on first insert) */
|
|
@@ -176,6 +251,8 @@ export interface OpenOptions {
|
|
|
176
251
|
* Fetches k*oversample candidates then reranks to return top k
|
|
177
252
|
*/
|
|
178
253
|
oversample?: number
|
|
254
|
+
/** Distance metric: "l2"/"euclidean" (default), "cosine", "dot"/"ip" */
|
|
255
|
+
metric?: string
|
|
179
256
|
}
|
|
180
257
|
|
|
181
258
|
export interface SearchResult {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omendb/omendb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Fast embedded vector database with HNSW indexing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"omendb.node"
|
|
50
50
|
],
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@omendb/omendb-darwin-x64": "0.0.
|
|
53
|
-
"@omendb/omendb-darwin-arm64": "0.0.
|
|
54
|
-
"@omendb/omendb-linux-x64-gnu": "0.0.
|
|
55
|
-
"@omendb/omendb-linux-arm64-gnu": "0.0.
|
|
52
|
+
"@omendb/omendb-darwin-x64": "0.0.12",
|
|
53
|
+
"@omendb/omendb-darwin-arm64": "0.0.12",
|
|
54
|
+
"@omendb/omendb-linux-x64-gnu": "0.0.12",
|
|
55
|
+
"@omendb/omendb-linux-arm64-gnu": "0.0.12"
|
|
56
56
|
}
|
|
57
57
|
}
|