Skip to content

Commit 330453d

Browse files
author
hemiao
committed
新增了TcVectorQuerier
1 parent 0ce0472 commit 330453d

File tree

11 files changed

+1254
-534
lines changed

11 files changed

+1254
-534
lines changed

moql-querier-milvus/src/main/java/org/datayoo/moql/querier/milvus/PartitionBy.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
*/
1818
package org.datayoo.moql.querier.milvus;
1919

20-
import io.milvus.param.MetricType;
2120
import org.datayoo.moql.EntityMap;
2221
import org.datayoo.moql.Operand;
2322
import org.datayoo.moql.operand.function.AbstractFunction;
2423

2524
import java.util.Arrays;
26-
import java.util.Collections;
27-
import java.util.LinkedList;
2825
import java.util.List;
2926

3027
/**

moql-querier-tcvector/pom.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.datayoo.moql</groupId>
7+
<artifactId>moql-parent</artifactId>
8+
<version>1.1.0</version>
9+
</parent>
10+
11+
12+
<artifactId>moql-querier-tcvector</artifactId>
13+
<version>1.0.0</version>
14+
15+
<name>moql-querier-tcvector</name>
16+
<url>http://maven.apache.org</url>
17+
18+
<properties>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
</properties>
21+
22+
<dependencies>
23+
<dependency>
24+
<groupId>junit</groupId>
25+
<artifactId>junit</artifactId>
26+
<version>4.13.1</version>
27+
<scope>test</scope>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>org.datayoo.moql</groupId>
32+
<artifactId>moql-querier</artifactId>
33+
<version>RELEASE</version>
34+
<scope>compile</scope>
35+
</dependency>
36+
37+
<dependency>
38+
<groupId>com.tencent.tcvectordb</groupId>
39+
<artifactId>vectordatabase-sdk-java</artifactId>
40+
<version>1.0.2</version>
41+
</dependency>
42+
43+
44+
</dependencies>
45+
</project>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package org.datayoo.moql.querier.tcvector;
2+
3+
import com.tencent.tcvectordb.model.param.dml.*;
4+
5+
import java.util.List;
6+
7+
public class BuilderProxy {
8+
SearchByVectorParam.Builder searchBuilder;
9+
10+
QueryParam.Builder queryBuilder;
11+
12+
protected boolean search = false;
13+
14+
public BuilderProxy() {
15+
searchBuilder = SearchByVectorParam.newBuilder();
16+
searchBuilder.withLimit(1);
17+
18+
queryBuilder = QueryParam.newBuilder();
19+
}
20+
21+
public BuilderProxy withFilter(String expr) {
22+
expr = expr.replace('\'', '"');
23+
searchBuilder.withFilter(new Filter(expr));
24+
queryBuilder.withFilter(new Filter(expr));
25+
return this;
26+
}
27+
28+
public BuilderProxy withOutFields(List<String> fields) {
29+
queryBuilder.withOutputFields(fields);
30+
searchBuilder.withOutputFields(fields);
31+
return this;
32+
}
33+
34+
public boolean isSearchMode() {
35+
return search;
36+
}
37+
38+
public BuilderProxy withSearchVectors(List<List<Double>> vectors) {
39+
this.search = true;
40+
searchBuilder.withVectors(vectors);
41+
return this;
42+
}
43+
44+
public BuilderProxy withQueryId(List<String> documentIds) {
45+
queryBuilder.withDocumentIds(documentIds);
46+
return this;
47+
}
48+
49+
public BuilderProxy withLimit(int limit) {
50+
queryBuilder.withLimit(limit);
51+
searchBuilder.withLimit(limit);
52+
return this;
53+
}
54+
55+
public BuilderProxy withOffset(int offset) {
56+
queryBuilder.withOffset(offset);
57+
return this;
58+
}
59+
60+
public SearchByVectorParam buildSearch() {
61+
62+
return searchBuilder.build();
63+
}
64+
65+
public BuilderProxy withParams(Params params) {
66+
searchBuilder.withParams(params);
67+
return this;
68+
}
69+
70+
public QueryParam buildQuery() {
71+
return queryBuilder.build();
72+
}
73+
74+
}

0 commit comments

Comments
 (0)