@omendb/omendb 0.0.16 → 0.0.18
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 +42 -6
- package/package.json +7 -7
package/index.d.ts
CHANGED
|
@@ -14,9 +14,10 @@ export declare class VectorDatabase {
|
|
|
14
14
|
* @param k - Number of results to return
|
|
15
15
|
* @param ef - Optional search width override
|
|
16
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)
|
|
17
18
|
* @returns Array of {id, distance, metadata}
|
|
18
19
|
*/
|
|
19
|
-
search(query: Array<number> | Float32Array, k: number, ef?: number | undefined | null, filter?: Record<string, unknown> | undefined): Array<SearchResult>
|
|
20
|
+
search(query: Array<number> | Float32Array, k: number, ef?: number | undefined | null, filter?: Record<string, unknown> | undefined, maxDistance?: number | undefined | null): Array<SearchResult>
|
|
20
21
|
/**
|
|
21
22
|
* Batch search with parallel execution (async).
|
|
22
23
|
*
|
|
@@ -79,6 +80,12 @@ export declare class VectorDatabase {
|
|
|
79
80
|
update(id: string, vector: Array<number> | Float32Array, metadata?: Record<string, unknown> | undefined): void
|
|
80
81
|
/** Get number of vectors in database. */
|
|
81
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
|
|
82
89
|
/** Get current ef_search value. */
|
|
83
90
|
get efSearch(): number
|
|
84
91
|
/** Set ef_search value. */
|
|
@@ -128,15 +135,25 @@ export declare class VectorDatabase {
|
|
|
128
135
|
* @param filter - Optional metadata filter
|
|
129
136
|
* @param alpha - Weight for vector vs text (0.0=text only, 1.0=vector only, default=0.5)
|
|
130
137
|
* @param rrfK - RRF constant (default=60, higher reduces rank influence)
|
|
131
|
-
* @
|
|
138
|
+
* @param subscores - Return separate keyword_score and semantic_score (default: false)
|
|
139
|
+
* @returns Array of {id, score, metadata, keyword_score?, semantic_score?}
|
|
132
140
|
*/
|
|
133
|
-
hybridSearch(queryVector: Array<number> | Float32Array, queryText: string, k: number, filter?: Record<string, unknown> | undefined, alpha?: number | undefined | null, rrfK?: number | undefined | null): Array<
|
|
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>
|
|
134
142
|
/**
|
|
135
143
|
* Flush pending changes to disk.
|
|
136
144
|
*
|
|
137
145
|
* For hybrid search, this commits text index changes.
|
|
138
146
|
*/
|
|
139
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
|
|
140
157
|
/** Merge another database into this one. */
|
|
141
158
|
mergeFrom(other: VectorDatabase): number
|
|
142
159
|
/**
|
|
@@ -177,6 +194,16 @@ export interface GetResult {
|
|
|
177
194
|
metadata: Record<string, unknown>
|
|
178
195
|
}
|
|
179
196
|
|
|
197
|
+
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
|
|
205
|
+
}
|
|
206
|
+
|
|
180
207
|
/**
|
|
181
208
|
* Open or create a vector database.
|
|
182
209
|
*
|
|
@@ -237,10 +264,13 @@ export interface OpenOptions {
|
|
|
237
264
|
/** HNSW ef_search: search quality/speed tradeoff (default: 100) */
|
|
238
265
|
efSearch?: number
|
|
239
266
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
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)
|
|
242
272
|
*/
|
|
243
|
-
quantization?: number
|
|
273
|
+
quantization?: boolean | string | number | null | undefined
|
|
244
274
|
/**
|
|
245
275
|
* Rescore candidates with exact distance (default: true when quantization enabled)
|
|
246
276
|
* Set to false for maximum speed at the cost of ~20% recall
|
|
@@ -262,6 +292,12 @@ export interface SearchResult {
|
|
|
262
292
|
metadata: Record<string, unknown>
|
|
263
293
|
}
|
|
264
294
|
|
|
295
|
+
export interface StatsResult {
|
|
296
|
+
dimensions: number
|
|
297
|
+
count: number
|
|
298
|
+
path: string
|
|
299
|
+
}
|
|
300
|
+
|
|
265
301
|
export interface TextSearchResult {
|
|
266
302
|
id: string
|
|
267
303
|
score: number
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omendb/omendb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"description": "Fast embedded vector database with HNSW + ACORN-1 filtered search",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"rust"
|
|
21
21
|
],
|
|
22
22
|
"author": "Nick Jaru",
|
|
23
|
-
"license": "
|
|
23
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">= 18"
|
|
26
26
|
},
|
|
@@ -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.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"
|
|
58
58
|
}
|
|
59
59
|
}
|