Skip to content

Commit c5ccdaf

Browse files
Support named vectors for hybrid queries
1 parent 529aa0f commit c5ccdaf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/graphql/hybrid.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface HybridArgs {
33
query: string;
44
vector?: number[];
55
properties?: string[];
6+
targetVectors?: string[];
67
fusionType?: FusionType;
78
}
89

@@ -16,13 +17,15 @@ export default class GraphQLHybrid {
1617
private query: string;
1718
private vector?: number[];
1819
private properties?: string[];
20+
private targetVectors?: string[];
1921
private fusionType?: FusionType;
2022

2123
constructor(args: HybridArgs) {
2224
this.alpha = args.alpha;
2325
this.query = args.query;
2426
this.vector = args.vector;
2527
this.properties = args.properties;
28+
this.targetVectors = args.targetVectors;
2629
this.fusionType = args.fusionType;
2730
}
2831

@@ -38,8 +41,11 @@ export default class GraphQLHybrid {
3841
}
3942

4043
if (this.properties && this.properties.length > 0) {
41-
const props = this.properties.join('","');
42-
args = [...args, `properties:["${props}"]`];
44+
args = [...args, `properties:${JSON.stringify(this.properties)}`];
45+
}
46+
47+
if (this.targetVectors && this.targetVectors.length > 0) {
48+
args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`];
4349
}
4450

4551
if (this.fusionType !== undefined) {

0 commit comments

Comments
 (0)