Skip to content

Commit db840f6

Browse files
add properties field to hybrid filter (#55)
1 parent f96dbb3 commit db840f6

11 files changed

+48
-10
lines changed

ci/docker-compose-azure-cc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- --scheme
1111
- http
1212
- --write-timeout=600s
13-
image: semitechnologies/weaviate:1.19.0
13+
image: semitechnologies/weaviate:1.19.2
1414
ports:
1515
- 8081:8081
1616
restart: on-failure:0

ci/docker-compose-cluster.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: '3.4'
33
services:
44
weaviate-node-1:
5-
image: semitechnologies/weaviate:1.19.0
5+
image: semitechnologies/weaviate:1.19.2
66
restart: on-failure:0
77
ports:
88
- "8087:8080"
@@ -25,7 +25,7 @@ services:
2525
- '8080'
2626
- --scheme
2727
- http
28-
image: semitechnologies/weaviate:1.19.0
28+
image: semitechnologies/weaviate:1.19.2
2929
ports:
3030
- 8088:8080
3131
- 6061:6060

ci/docker-compose-okta-cc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- --scheme
1111
- http
1212
- --write-timeout=600s
13-
image: semitechnologies/weaviate:1.19.0
13+
image: semitechnologies/weaviate:1.19.2
1414
ports:
1515
- 8082:8082
1616
restart: on-failure:0

ci/docker-compose-okta-users.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- --scheme
1111
- http
1212
- --write-timeout=600s
13-
image: semitechnologies/weaviate:1.19.0
13+
image: semitechnologies/weaviate:1.19.2
1414
ports:
1515
- 8083:8083
1616
restart: on-failure:0

ci/docker-compose-openai.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
- '8086'
1010
- --scheme
1111
- http
12-
image: semitechnologies/weaviate:1.19.0
12+
image: semitechnologies/weaviate:1.19.2
1313
ports:
1414
- 8086:8086
1515
restart: on-failure:0

ci/docker-compose-wcs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
- --scheme
1111
- http
1212
- --write-timeout=600s
13-
image: semitechnologies/weaviate:1.19.0
13+
image: semitechnologies/weaviate:1.19.2
1414
ports:
1515
- 8085:8085
1616
restart: on-failure:0

ci/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: '3.4'
33
services:
44
weaviate:
5-
image: semitechnologies/weaviate:1.19.0
5+
image: semitechnologies/weaviate:1.19.2
66
restart: on-failure:0
77
ports:
88
- "8080:8080"

src/cluster/journey.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const {
77
SOUP_CLASS_NAME,
88
} = require('../utils/testData');
99

10-
const EXPECTED_WEAVIATE_VERSION = '1.19.0';
11-
const EXPECTED_WEAVIATE_GIT_HASH = '48456a1';
10+
const EXPECTED_WEAVIATE_VERSION = '1.19.2';
11+
const EXPECTED_WEAVIATE_GIT_HASH = '44d10b2';
1212

1313
describe('cluster nodes endpoint', () => {
1414
const client = weaviate.client({

src/graphql/getter.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,18 @@ describe('hybrid valid searchers', () => {
12301230

12311231
expect(mockClient.query).toHaveBeenCalledWith(expectedQuery);
12321232
});
1233+
1234+
test('queries and properties', () => {
1235+
const expectedQuery = `{Get{Person(hybrid:{query:"accountant",properties:["name","employer"]}){name}}}`;
1236+
1237+
new Getter(mockClient)
1238+
.withClassName('Person')
1239+
.withFields('name')
1240+
.withHybrid({ query: 'accountant', properties: ['name', 'employer'] })
1241+
.do();
1242+
1243+
expect(mockClient.query).toHaveBeenCalledWith(expectedQuery);
1244+
});
12331245
});
12341246

12351247
describe('generative search', () => {

src/graphql/hybrid.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ export interface HybridArgs {
22
alpha?: number;
33
query: string;
44
vector?: number[];
5+
properties?: string[];
56
}
67

78
export default class GraphQLHybrid {
89
private alpha?: number;
910
private query: string;
1011
private vector?: number[];
12+
private properties?: string[];
1113

1214
constructor(args: HybridArgs) {
1315
this.alpha = args.alpha;
1416
this.query = args.query;
1517
this.vector = args.vector;
18+
this.properties = args.properties;
1619
}
1720

1821
toString() {
@@ -26,6 +29,11 @@ export default class GraphQLHybrid {
2629
args = [...args, `vector:${JSON.stringify(this.vector)}`];
2730
}
2831

32+
if (this.properties && this.properties.length > 0) {
33+
const props = this.properties.join('","');
34+
args = [...args, `properties:["${props}"]`];
35+
}
36+
2937
return `{${args.join(',')}}`;
3038
}
3139
}

0 commit comments

Comments
 (0)