@hakodb/client 0.6.3 → 0.6.5
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/package.json +1 -1
- package/src/client.ts +31 -5
- package/src/native.ts +51 -5
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -1112,9 +1112,9 @@ export class CollectionReference {
|
|
|
1112
1112
|
ensureOk(this.client.nativeBindings().dropTraverseIndex(this.client.engineHandle(), this.name), this.client.nativeBindings(), 'dropTraverseIndex');
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
|
-
/** HNSW-tuned vector index (m = edges per node, efConstruction = build beam, efSearch = query beam; 0 = engine default). */
|
|
1116
|
-
async createVectorIndexV2(field: string, dim: number, metric: VectorMetric = 'cosine', m = 0, efConstruction = 0, efSearch = 0): Promise<void> {
|
|
1117
|
-
ensureOk(this.client.nativeBindings().createVectorIndexV2(this.client.engineHandle(), this.name, field, dim, metric === 'l2' ? 1 : 0, m, efConstruction, efSearch), this.client.nativeBindings(), 'createVectorIndexV2');
|
|
1115
|
+
/** HNSW-tuned vector index (m = edges per node, efConstruction = build beam, efSearch = query beam; 0 = engine default). binaryStage1 enables the popcount stage-1 filter (0 = int8 default). */
|
|
1116
|
+
async createVectorIndexV2(field: string, dim: number, metric: VectorMetric = 'cosine', m = 0, efConstruction = 0, efSearch = 0, binaryStage1 = 0): Promise<void> {
|
|
1117
|
+
ensureOk(this.client.nativeBindings().createVectorIndexV2(this.client.engineHandle(), this.name, field, dim, metric === 'l2' ? 1 : 0, m, efConstruction, efSearch, binaryStage1), this.client.nativeBindings(), 'createVectorIndexV2');
|
|
1118
1118
|
}
|
|
1119
1119
|
|
|
1120
1120
|
/** Graph BFS with the v0.19 extensions: via-edge hops, node/edge predicates, opt-in path/via projections. */
|
|
@@ -1144,14 +1144,40 @@ export class CollectionReference {
|
|
|
1144
1144
|
return JSON.parse(json);
|
|
1145
1145
|
}
|
|
1146
1146
|
|
|
1147
|
-
/** Whole-graph analysis: "components" | "cycle" | "topo". */
|
|
1148
|
-
async graphAnalysis(op: 'components' | 'cycle' | 'topo', opts: PathOptions = {}): Promise<unknown> {
|
|
1147
|
+
/** Whole-graph analysis: "components" | "cycle" | "topo" | "degrees". */
|
|
1148
|
+
async graphAnalysis(op: 'components' | 'cycle' | 'topo' | 'degrees', opts: PathOptions = {}): Promise<unknown> {
|
|
1149
1149
|
const native = this.client.nativeBindings();
|
|
1150
1150
|
const o = resolvePathOptions(opts);
|
|
1151
1151
|
const json = native.graphAnalysis(this.client.engineHandle(), this.name, op, o.direction, o.edge, o.via, o.nodeField, o.nodeJSON);
|
|
1152
1152
|
if (json === null) throw new Error(`graphAnalysis failed: ${native.lastError()}`);
|
|
1153
1153
|
return JSON.parse(json);
|
|
1154
1154
|
}
|
|
1155
|
+
|
|
1156
|
+
/** Personalized PageRank: seeds = ["col/id"] or null for classic; damping 0 = 0.85; top 0 = all nodes. */
|
|
1157
|
+
async graphPagerank(seeds: string[] | null, opts: PathOptions & { damping?: number; top?: number } = {}): Promise<unknown> {
|
|
1158
|
+
const native = this.client.nativeBindings();
|
|
1159
|
+
const o = resolvePathOptions(opts);
|
|
1160
|
+
const json = native.graphPagerank(this.client.engineHandle(), this.name, seeds === null ? null : JSON.stringify(seeds), o.direction, o.edge, o.via, o.nodeField, o.nodeJSON, opts.damping ?? 0, opts.top ?? 0);
|
|
1161
|
+
if (json === null) throw new Error(`graphPagerank failed: ${native.lastError()}`);
|
|
1162
|
+
return JSON.parse(json);
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/** Seed-scoped N-hop subgraph: same node/edge shape as exportGraph, scoped to one seed. nodeCap 0 = unlimited. */
|
|
1166
|
+
async subgraph(seedId: string, opts: PathOptions & { nodeCap?: number } = {}): Promise<unknown> {
|
|
1167
|
+
const native = this.client.nativeBindings();
|
|
1168
|
+
const o = resolvePathOptions(opts);
|
|
1169
|
+
const json = native.subgraph(this.client.engineHandle(), this.name, seedId, o.maxDepth, o.direction, o.edge, o.via, o.nodeField, o.nodeJSON, opts.nodeCap ?? 0);
|
|
1170
|
+
if (json === null) throw new Error(`subgraph failed: ${native.lastError()}`);
|
|
1171
|
+
return JSON.parse(json);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/** Hybrid retrieval: FTS (sparse) + KNN (dense) fused with RRF. rrfK 0 = default 60. */
|
|
1175
|
+
async hybridSearch(textField: string, textQuery: string, vecField: string, vec: Float32Array, k = 10, rrfK = 0): Promise<unknown> {
|
|
1176
|
+
const native = this.client.nativeBindings();
|
|
1177
|
+
const json = native.hybridSearch(this.client.engineHandle(), this.name, textField, textQuery, vecField, vec, k, rrfK);
|
|
1178
|
+
if (json === null) throw new Error(`hybridSearch failed: ${native.lastError()}`);
|
|
1179
|
+
return JSON.parse(json);
|
|
1180
|
+
}
|
|
1155
1181
|
}
|
|
1156
1182
|
|
|
1157
1183
|
export class DocumentReference {
|
package/src/native.ts
CHANGED
|
@@ -211,11 +211,21 @@ export interface NativeBindings {
|
|
|
211
211
|
dropEdgeIndex(engine: Handle, collection: string): number;
|
|
212
212
|
dropFtsIndex(engine: Handle, collection: string, field: string): number;
|
|
213
213
|
dropTraverseIndex(engine: Handle, collection: string): number;
|
|
214
|
-
createVectorIndexV2(engine: Handle, collection: string, field: string, dim: number, metric: number, m: number, efConstruction: number, efSearch: number): number;
|
|
214
|
+
createVectorIndexV2(engine: Handle, collection: string, field: string, dim: number, metric: number, m: number, efConstruction: number, efSearch: number, binaryStage1: number): number;
|
|
215
215
|
findPathsFull(engine: Handle, collection: string, id: string, direction: number, edge: string | null, via: string | null, maxDepth: number, k: number, includePath: boolean, includeVia: boolean, nodeField: string | null, nodeJSON: string | null, typeField: string | null, typeJSON: string | null, matchField: string | null, matchJSON: string | null): string | null;
|
|
216
216
|
simplePathsFull(engine: Handle, collection: string, id: string, direction: number, edge: string | null, via: string | null, weight: string | null, maxDepth: number, k: number, includePath: boolean, includeVia: boolean, nodeField: string | null, nodeJSON: string | null, typeField: string | null, typeJSON: string | null, matchField: string | null, matchJSON: string | null): string | null;
|
|
217
217
|
exportGraph(engine: Handle, collection: string, direction: number, edge: string | null, via: string | null, nodeField: string | null, nodeJSON: string | null): string | null;
|
|
218
218
|
graphAnalysis(engine: Handle, collection: string, op: string, direction: number, edge: string | null, via: string | null, nodeField: string | null, nodeJSON: string | null): string | null;
|
|
219
|
+
graphPagerank(engine: Handle, collection: string, seeds: string | null, direction: number, edge: string | null, via: string | null, nodeField: string | null, nodeJSON: string | null, damping: number, top: number): string | null;
|
|
220
|
+
subgraph(engine: Handle, collection: string, seedId: string, maxDepth: number, direction: number, edge: string | null, via: string | null, nodeField: string | null, nodeJSON: string | null, nodeCap: number): string | null;
|
|
221
|
+
hybridSearch(engine: Handle, collection: string, textField: string, textQuery: string, vecField: string, vec: Float32Array, k: number, rrfK: number): string | null;
|
|
222
|
+
// v0.21.0 parity (#217 wave): exclusive open, idempotent boot schema,
|
|
223
|
+
// filtered hybrid/KNN, subgraph projection.
|
|
224
|
+
engineOpenExclusive(path: string): Handle;
|
|
225
|
+
engineEnsureIndexes(engine: Handle, schemaJson: string): number;
|
|
226
|
+
hybridSearchFiltered(engine: Handle, collection: string, textField: string, textQuery: string, vecField: string, vec: Float32Array, k: number, rrfK: number, filtersJson: string | null): string | null;
|
|
227
|
+
findNearScoredFiltered(engine: Handle, collection: string, vecField: string, vec: Float32Array, k: number, maxDistance: number, filtersJson: string | null): string | null;
|
|
228
|
+
subgraphProjected(engine: Handle, collection: string, seedId: string, maxDepth: number, direction: number, edge: string | null, via: string | null, nodeField: string | null, nodeJSON: string | null, nodeCap: number, fieldsJson: string | null): string | null;
|
|
219
229
|
insertJSON(engine: Handle, collection: string, id: string, json: string): number;
|
|
220
230
|
batchSetJSON(batch: Handle, collection: string, id: string, json: string): number;
|
|
221
231
|
|
|
@@ -427,7 +437,16 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
|
|
|
427
437
|
hk_engine_drop_edge_index: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.i32 },
|
|
428
438
|
hk_engine_drop_fts_index: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring], returns: FFIType.i32 },
|
|
429
439
|
hk_engine_drop_traverse_index: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.i32 },
|
|
430
|
-
hk_engine_create_vector_index_v2: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.u32, FFIType.usize, FFIType.usize, FFIType.usize], returns: FFIType.i32 },
|
|
440
|
+
hk_engine_create_vector_index_v2: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.u32, FFIType.usize, FFIType.usize, FFIType.usize, FFIType.u32], returns: FFIType.i32 },
|
|
441
|
+
hk_engine_graph_pagerank: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.f64, FFIType.usize], returns: FFIType.ptr },
|
|
442
|
+
hk_engine_subgraph: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.usize], returns: FFIType.ptr },
|
|
443
|
+
hk_engine_hybrid_search: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.ptr, FFIType.usize, FFIType.usize, FFIType.usize], returns: FFIType.ptr },
|
|
444
|
+
// v0.21.0 parity (#217 wave)
|
|
445
|
+
hk_engine_open_exclusive: { args: [FFIType.cstring], returns: FFIType.ptr },
|
|
446
|
+
hk_engine_ensure_indexes: { args: [FFIType.ptr, FFIType.cstring], returns: FFIType.i32 },
|
|
447
|
+
hk_engine_hybrid_search_filtered: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.ptr, FFIType.usize, FFIType.usize, FFIType.usize, FFIType.cstring], returns: FFIType.ptr },
|
|
448
|
+
hk_engine_find_near_scored_filtered: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.ptr, FFIType.usize, FFIType.usize, FFIType.f64, FFIType.cstring], returns: FFIType.ptr },
|
|
449
|
+
hk_engine_subgraph_json_projected: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.usize, FFIType.cstring], returns: FFIType.ptr },
|
|
431
450
|
hk_engine_find_paths_v4: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.usize, FFIType.usize, FFIType.u32, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
432
451
|
hk_engine_find_simple_paths_v3: { args: [FFIType.ptr, FFIType.cstring, FFIType.cstring, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.usize, FFIType.usize, FFIType.u32, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
433
452
|
hk_engine_export_graph: { args: [FFIType.ptr, FFIType.cstring, FFIType.u32, FFIType.cstring, FFIType.cstring, FFIType.cstring, FFIType.cstring], returns: FFIType.ptr },
|
|
@@ -613,6 +632,12 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
|
|
|
613
632
|
|
|
614
633
|
return {
|
|
615
634
|
engineOpen: (path) => symbols.hk_engine_open(toC(path)),
|
|
635
|
+
// v0.21.0 parity (#217 wave)
|
|
636
|
+
engineOpenExclusive: (path) => symbols.hk_engine_open_exclusive(toC(path)),
|
|
637
|
+
engineEnsureIndexes: (engine, schemaJson) => symbols.hk_engine_ensure_indexes(engine, toC(schemaJson)),
|
|
638
|
+
hybridSearchFiltered: (engine, collection, textField, textQuery, vecField, vec, k, rrfK, filtersJson) => ptrToStringAndFree(symbols.hk_engine_hybrid_search_filtered(engine, toC(collection), toC(textField), toC(textQuery), toC(vecField), vec, vec.length, k, rrfK, filtersJson === null ? null : toC(filtersJson))),
|
|
639
|
+
findNearScoredFiltered: (engine, collection, vecField, vec, k, maxDistance, filtersJson) => ptrToStringAndFree(symbols.hk_engine_find_near_scored_filtered(engine, toC(collection), toC(vecField), vec, vec.length, k, maxDistance, filtersJson === null ? null : toC(filtersJson))),
|
|
640
|
+
subgraphProjected: (engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap, fieldsJson) => ptrToStringAndFree(symbols.hk_engine_subgraph_json_projected(engine, toC(collection), toC(seedId), maxDepth, direction, edge === null ? null : toC(edge), via === null ? null : toC(via), nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON), nodeCap, fieldsJson === null ? null : toC(fieldsJson))),
|
|
616
641
|
engineIsIndexesReady: (engine) => symbols.hk_engine_is_indexes_ready(engine),
|
|
617
642
|
engineOpenWithConfig: (path, config) => symbols.hk_engine_open_with_config(toC(path), config),
|
|
618
643
|
engineFree: (engine) => symbols.hk_engine_free(engine),
|
|
@@ -811,11 +836,14 @@ async function createBunBindings(libPath: string): Promise<NativeBindings> {
|
|
|
811
836
|
dropEdgeIndex: (engine, collection) => symbols.hk_engine_drop_edge_index(engine, toC(collection)),
|
|
812
837
|
dropFtsIndex: (engine, collection, field) => symbols.hk_engine_drop_fts_index(engine, toC(collection), toC(field)),
|
|
813
838
|
dropTraverseIndex: (engine, collection) => symbols.hk_engine_drop_traverse_index(engine, toC(collection)),
|
|
814
|
-
createVectorIndexV2: (engine, collection, field, dim, metric, m, efConstruction, efSearch) => symbols.hk_engine_create_vector_index_v2(engine, toC(collection), toC(field), dim, metric, m, efConstruction, efSearch),
|
|
839
|
+
createVectorIndexV2: (engine, collection, field, dim, metric, m, efConstruction, efSearch, binaryStage1) => symbols.hk_engine_create_vector_index_v2(engine, toC(collection), toC(field), dim, metric, m, efConstruction, efSearch, binaryStage1),
|
|
815
840
|
findPathsFull: (engine, collection, id, direction, edge, via, maxDepth, k, includePath, includeVia, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON) => ptrToStringAndFree(symbols.hk_engine_find_paths_v4(engine, toC(collection), toC(id), direction, edge === null ? null : toC(edge), via === null ? null : toC(via), maxDepth, k, includePath ? 1 : 0, includeVia ? 1 : 0, nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON), typeField === null ? null : toC(typeField), typeJSON === null ? null : toC(typeJSON), matchField === null ? null : toC(matchField), matchJSON === null ? null : toC(matchJSON))),
|
|
816
841
|
simplePathsFull: (engine, collection, id, direction, edge, via, weight, maxDepth, k, includePath, includeVia, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON) => ptrToStringAndFree(symbols.hk_engine_find_simple_paths_v3(engine, toC(collection), toC(id), direction, edge === null ? null : toC(edge), via === null ? null : toC(via), weight === null ? null : toC(weight), maxDepth, k, includePath ? 1 : 0, includeVia ? 1 : 0, nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON), typeField === null ? null : toC(typeField), typeJSON === null ? null : toC(typeJSON), matchField === null ? null : toC(matchField), matchJSON === null ? null : toC(matchJSON))),
|
|
817
842
|
exportGraph: (engine, collection, direction, edge, via, nodeField, nodeJSON) => ptrToStringAndFree(symbols.hk_engine_export_graph(engine, toC(collection), direction, edge === null ? null : toC(edge), via === null ? null : toC(via), nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON))),
|
|
818
843
|
graphAnalysis: (engine, collection, op, direction, edge, via, nodeField, nodeJSON) => ptrToStringAndFree(symbols.hk_engine_graph_analysis(engine, toC(collection), toC(op), direction, edge === null ? null : toC(edge), via === null ? null : toC(via), nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON))),
|
|
844
|
+
graphPagerank: (engine, collection, seeds, direction, edge, via, nodeField, nodeJSON, damping, top) => ptrToStringAndFree(symbols.hk_engine_graph_pagerank(engine, toC(collection), seeds === null ? null : toC(seeds), direction, edge === null ? null : toC(edge), via === null ? null : toC(via), nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON), damping, top)),
|
|
845
|
+
subgraph: (engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap) => ptrToStringAndFree(symbols.hk_engine_subgraph(engine, toC(collection), toC(seedId), maxDepth, direction, edge === null ? null : toC(edge), via === null ? null : toC(via), nodeField === null ? null : toC(nodeField), nodeJSON === null ? null : toC(nodeJSON), nodeCap)),
|
|
846
|
+
hybridSearch: (engine, collection, textField, textQuery, vecField, vec, k, rrfK) => ptrToStringAndFree(symbols.hk_engine_hybrid_search(engine, toC(collection), toC(textField), toC(textQuery), toC(vecField), vec, vec.length, k, rrfK)),
|
|
819
847
|
insertJSON: (engine, collection, id, json) => symbols.hk_engine_insert_json(engine, toC(collection), toC(id), toC(json)),
|
|
820
848
|
batchSetJSON: (batch, collection, id, json) => symbols.hk_batch_set_json(batch, toC(collection), toC(id), toC(json)),
|
|
821
849
|
|
|
@@ -1065,7 +1093,16 @@ async function createNodeBindings(libPath: string): Promise<NativeBindings> {
|
|
|
1065
1093
|
hk_engine_drop_edge_index: lib.func('int hk_engine_drop_edge_index(HK_Engine* engine, const char* collection)'),
|
|
1066
1094
|
hk_engine_drop_fts_index: lib.func('int hk_engine_drop_fts_index(HK_Engine* engine, const char* collection, const char* field)'),
|
|
1067
1095
|
hk_engine_drop_traverse_index: lib.func('int hk_engine_drop_traverse_index(HK_Engine* engine, const char* collection)'),
|
|
1068
|
-
hk_engine_create_vector_index_v2: lib.func('int hk_engine_create_vector_index_v2(HK_Engine* engine, const char* collection, const char* field, uint32_t dim, uint32_t metric, size_t m, size_t ef_construction, size_t ef_search)'),
|
|
1096
|
+
hk_engine_create_vector_index_v2: lib.func('int hk_engine_create_vector_index_v2(HK_Engine* engine, const char* collection, const char* field, uint32_t dim, uint32_t metric, size_t m, size_t ef_construction, size_t ef_search, uint32_t binary_stage1)'),
|
|
1097
|
+
hk_engine_graph_pagerank: lib.func('HeapStr hk_engine_graph_pagerank(HK_Engine* engine, const char* collection, const char* seeds_json, uint32_t direction, const char* edge, const char* via, const char* filter_field, const char* filter_json, double damping, size_t top)'),
|
|
1098
|
+
hk_engine_subgraph: lib.func('HeapStr hk_engine_subgraph(HK_Engine* engine, const char* collection, const char* seed_id, uint32_t max_depth, uint32_t direction, const char* edge, const char* via, const char* filter_field, const char* filter_json, size_t node_cap)'),
|
|
1099
|
+
hk_engine_hybrid_search: lib.func('HeapStr hk_engine_hybrid_search(HK_Engine* engine, const char* collection, const char* text_field, const char* text_query, const char* vec_field, const float* vec, size_t vec_len, size_t k, size_t rrf_k)'),
|
|
1100
|
+
// v0.21.0 parity (#217 wave)
|
|
1101
|
+
hk_engine_open_exclusive: lib.func('HK_Engine* hk_engine_open_exclusive(const char* path)'),
|
|
1102
|
+
hk_engine_ensure_indexes: lib.func('int hk_engine_ensure_indexes(HK_Engine* engine, const char* schema_json)'),
|
|
1103
|
+
hk_engine_hybrid_search_filtered: lib.func('HeapStr hk_engine_hybrid_search_filtered(HK_Engine* engine, const char* collection, const char* text_field, const char* text_query, const char* vec_field, const float* vec, size_t vec_len, size_t k, size_t rrf_k, const char* filters_json)'),
|
|
1104
|
+
hk_engine_find_near_scored_filtered: lib.func('HeapStr hk_engine_find_near_scored_filtered(HK_Engine* engine, const char* collection, const char* field, const float* vec, size_t vec_len, size_t k, double max_distance, const char* filters_json)'),
|
|
1105
|
+
hk_engine_subgraph_json_projected: lib.func('HeapStr hk_engine_subgraph_json_projected(HK_Engine* engine, const char* collection, const char* seed_id, uint32_t max_depth, uint32_t direction, const char* edge, const char* via, const char* filter_field, const char* filter_json, size_t node_cap, const char* fields_json)'),
|
|
1069
1106
|
hk_engine_find_paths_v4: lib.func('HeapStr hk_engine_find_paths_v4(HK_Engine* engine, const char* collection, const char* doc_id, uint32_t direction, const char* edge, const char* via, size_t max_depth, size_t k, uint32_t include_path, uint32_t include_via, const char* filter_field, const char* filter_json, const char* type_field, const char* type_json, const char* match_field, const char* match_json)'),
|
|
1070
1107
|
hk_engine_find_simple_paths_v3: lib.func('HeapStr hk_engine_find_simple_paths_v3(HK_Engine* engine, const char* collection, const char* doc_id, uint32_t direction, const char* edge, const char* via, const char* weight, size_t max_depth, size_t k, uint32_t include_path, uint32_t include_via, const char* filter_field, const char* filter_json, const char* type_field, const char* type_json, const char* match_field, const char* match_json)'),
|
|
1071
1108
|
hk_engine_export_graph: lib.func('HeapStr hk_engine_export_graph(HK_Engine* engine, const char* collection, uint32_t direction, const char* edge, const char* via, const char* filter_field, const char* filter_json)'),
|
|
@@ -1258,6 +1295,12 @@ async function createNodeBindings(libPath: string): Promise<NativeBindings> {
|
|
|
1258
1295
|
|
|
1259
1296
|
return {
|
|
1260
1297
|
engineOpen: (path) => fn.hk_engine_open(path),
|
|
1298
|
+
// v0.21.0 parity (#217 wave) — koffi takes null for char* directly
|
|
1299
|
+
engineOpenExclusive: (path) => fn.hk_engine_open_exclusive(path),
|
|
1300
|
+
engineEnsureIndexes: (engine, schemaJson) => fn.hk_engine_ensure_indexes(engine, schemaJson),
|
|
1301
|
+
hybridSearchFiltered: (engine, collection, textField, textQuery, vecField, vec, k, rrfK, filtersJson) => fn.hk_engine_hybrid_search_filtered(engine, collection, textField, textQuery, vecField, Buffer.from(vec.buffer, vec.byteOffset, vec.byteLength), vec.length, k, rrfK, filtersJson),
|
|
1302
|
+
findNearScoredFiltered: (engine, collection, vecField, vec, k, maxDistance, filtersJson) => fn.hk_engine_find_near_scored_filtered(engine, collection, vecField, Buffer.from(vec.buffer, vec.byteOffset, vec.byteLength), vec.length, k, maxDistance, filtersJson),
|
|
1303
|
+
subgraphProjected: (engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap, fieldsJson) => fn.hk_engine_subgraph_json_projected(engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap, fieldsJson),
|
|
1261
1304
|
engineIsIndexesReady: (engine) => fn.hk_engine_is_indexes_ready(engine),
|
|
1262
1305
|
engineOpenWithConfig: (path, config) => fn.hk_engine_open_with_config(path, config),
|
|
1263
1306
|
engineFree: (engine) => fn.hk_engine_free(engine),
|
|
@@ -1442,11 +1485,14 @@ async function createNodeBindings(libPath: string): Promise<NativeBindings> {
|
|
|
1442
1485
|
dropEdgeIndex: (engine, collection) => fn.hk_engine_drop_edge_index(engine, collection),
|
|
1443
1486
|
dropFtsIndex: (engine, collection, field) => fn.hk_engine_drop_fts_index(engine, collection, field),
|
|
1444
1487
|
dropTraverseIndex: (engine, collection) => fn.hk_engine_drop_traverse_index(engine, collection),
|
|
1445
|
-
createVectorIndexV2: (engine, collection, field, dim, metric, m, efConstruction, efSearch) => fn.hk_engine_create_vector_index_v2(engine, collection, field, dim, metric, m, efConstruction, efSearch),
|
|
1488
|
+
createVectorIndexV2: (engine, collection, field, dim, metric, m, efConstruction, efSearch, binaryStage1) => fn.hk_engine_create_vector_index_v2(engine, collection, field, dim, metric, m, efConstruction, efSearch, binaryStage1),
|
|
1446
1489
|
findPathsFull: (engine, collection, id, direction, edge, via, maxDepth, k, includePath, includeVia, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON) => fn.hk_engine_find_paths_v4(engine, collection, id, direction, edge, via, maxDepth, k, includePath ? 1 : 0, includeVia ? 1 : 0, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON),
|
|
1447
1490
|
simplePathsFull: (engine, collection, id, direction, edge, via, weight, maxDepth, k, includePath, includeVia, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON) => fn.hk_engine_find_simple_paths_v3(engine, collection, id, direction, edge, via, weight, maxDepth, k, includePath ? 1 : 0, includeVia ? 1 : 0, nodeField, nodeJSON, typeField, typeJSON, matchField, matchJSON),
|
|
1448
1491
|
exportGraph: (engine, collection, direction, edge, via, nodeField, nodeJSON) => fn.hk_engine_export_graph(engine, collection, direction, edge, via, nodeField, nodeJSON),
|
|
1449
1492
|
graphAnalysis: (engine, collection, op, direction, edge, via, nodeField, nodeJSON) => fn.hk_engine_graph_analysis(engine, collection, op, direction, edge, via, nodeField, nodeJSON),
|
|
1493
|
+
graphPagerank: (engine, collection, seeds, direction, edge, via, nodeField, nodeJSON, damping, top) => fn.hk_engine_graph_pagerank(engine, collection, seeds, direction, edge, via, nodeField, nodeJSON, damping, top),
|
|
1494
|
+
subgraph: (engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap) => fn.hk_engine_subgraph(engine, collection, seedId, maxDepth, direction, edge, via, nodeField, nodeJSON, nodeCap),
|
|
1495
|
+
hybridSearch: (engine, collection, textField, textQuery, vecField, vec, k, rrfK) => fn.hk_engine_hybrid_search(engine, collection, textField, textQuery, vecField, vec, k, rrfK),
|
|
1450
1496
|
insertJSON: (engine, collection, id, json) => fn.hk_engine_insert_json(engine, collection, id, json),
|
|
1451
1497
|
batchSetJSON: (batch, collection, id, json) => fn.hk_batch_set_json(batch, collection, id, json),
|
|
1452
1498
|
|