Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ba58d37
chore: gitignore .factorypath generated by maven-lombok-plugin
bevzzz Jan 20, 2025
8d8fb19
chore: upgrage maven-compiler-plugin to work with later Java version …
bevzzz Jan 20, 2025
1324e60
spike(wip): use gRPC client for nearVector search
bevzzz Jan 20, 2025
92bc363
spike: add WhereFilter and NearVectorArgument
bevzzz Feb 5, 2025
3c18479
fix: use toByteString utility from gRPC batch implementation
bevzzz Feb 5, 2025
a97f447
bench: add junit-benchmarks harness
bevzzz Feb 5, 2025
e3bb5f2
test: use longer vectors with random values
bevzzz Feb 6, 2025
d55c50c
bench: use a simpler benchmarking technique, remove junit-benchmarkin…
bevzzz Feb 6, 2025
ce4a3c3
spike: introduce experimental query syntax
bevzzz Feb 7, 2025
6a8ec90
spike: implement Where filtering for text and text array fields + and…
bevzzz Feb 7, 2025
b5c771a
spike: map returned properties to POJOs on search
bevzzz Feb 10, 2025
adc6ea4
spike: batch inserting objects
bevzzz Feb 11, 2025
ec5a5b7
chore: add examples for demo
bevzzz Feb 11, 2025
e20e3ac
chore: separate benchmarking test cases from examples
bevzzz Feb 12, 2025
ed5fe9f
skip: add remaining Where operators and data types
bevzzz Feb 12, 2025
422817a
spike: create filters from Map<String, Object>
bevzzz Feb 12, 2025
5487068
fix: append nested filters to nested gRPC stubs
bevzzz Feb 12, 2025
d889499
fix: get first element in the list with .get(0)
bevzzz Feb 14, 2025
802ca25
fix: apply filters correctly and test the results
bevzzz Feb 14, 2025
9d4ca4a
fix: initialize client.datax without refreshing dbVersionProvider
bevzzz Feb 17, 2025
b767535
ci: ignore flaky tests suites for 5.1.0-alpha1 release
bevzzz Feb 17, 2025
8c94cd1
test(broken): use Array and List<?> filters
bevzzz Feb 18, 2025
86862ab
chore: delete old commented out code
bevzzz Feb 18, 2025
9ba37c4
fix: collect Stream with Collectors.toList()
bevzzz Feb 18, 2025
1aa79b8
fix: use random generation API from Java 8
bevzzz Feb 18, 2025
ce1401d
test: use CONTAINS_ALL operator for array filters
bevzzz Feb 19, 2025
fe63e78
fix: map correct operator in the enum
bevzzz Feb 19, 2025
3f135fd
test: activate all @Test
bevzzz Feb 19, 2025
0592ec5
Add support for alpha releases
antas-marcin Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
*.iml
# Maven
target/
# maven-lombok-plugin
.factorypath
16 changes: 15 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>8</maven.compiler.release>
<lombok.version>1.18.36</lombok.version>
<gson.version>2.11.0</gson.version>
<httpclient.version>5.4.1</httpclient.version>
Expand All @@ -72,6 +73,7 @@
<oauth2-oidc-sdk.version>11.20.1</oauth2-oidc-sdk.version>
<mock-server.version>5.15.0</mock-server.version>
<protobuf.java.version>4.29.1</protobuf.java.version>
<protobuf.java-util.version>4.29.1</protobuf.java-util.version>
<grpc-netty-shaded.version>1.68.2</grpc-netty-shaded.version>
<grpc-protobuf.version>1.68.2</grpc-protobuf.version>
<grpc-stub.version>1.68.2</grpc-stub.version>
Expand All @@ -84,6 +86,11 @@
<artifactId>protobuf-java</artifactId>
<version>${protobuf.java.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.java-util.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
Expand Down Expand Up @@ -237,7 +244,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -273,6 +280,13 @@
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/io/weaviate/client/WeaviateClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.weaviate.client;

import java.util.Optional;

import io.weaviate.client.base.http.HttpClient;
import io.weaviate.client.base.http.builder.HttpApacheClientBuilder;
import io.weaviate.client.base.http.impl.CommonsHttpClientImpl;
Expand All @@ -15,10 +17,10 @@
import io.weaviate.client.v1.contextionary.Contextionary;
import io.weaviate.client.v1.data.Data;
import io.weaviate.client.v1.graphql.GraphQL;
import io.weaviate.client.v1.grpc.GRPC;
import io.weaviate.client.v1.misc.Misc;
import io.weaviate.client.v1.misc.api.MetaGetter;
import io.weaviate.client.v1.schema.Schema;
import java.util.Optional;

public class WeaviateClient {
private final Config config;
Expand All @@ -28,12 +30,16 @@ public class WeaviateClient {
private final HttpClient httpClient;
private final AccessTokenProvider tokenProvider;

public final io.weaviate.client.v1.experimental.Collections collections;
public final io.weaviate.client.v1.experimental.DataClient datax;

public WeaviateClient(Config config) {
this(config, new CommonsHttpClientImpl(config.getHeaders(), null, HttpApacheClientBuilder.build(config)), null);
}

public WeaviateClient(Config config, AccessTokenProvider tokenProvider) {
this(config, new CommonsHttpClientImpl(config.getHeaders(), tokenProvider, HttpApacheClientBuilder.build(config)), tokenProvider);
this(config, new CommonsHttpClientImpl(config.getHeaders(), tokenProvider, HttpApacheClientBuilder.build(config)),
tokenProvider);
}

public WeaviateClient(Config config, HttpClient httpClient, AccessTokenProvider tokenProvider) {
Expand All @@ -43,6 +49,10 @@ public WeaviateClient(Config config, HttpClient httpClient, AccessTokenProvider
dbVersionSupport = new DbVersionSupport(dbVersionProvider);
grpcVersionSupport = new GrpcVersionSupport(dbVersionProvider);
this.tokenProvider = tokenProvider;

this.collections = new io.weaviate.client.v1.experimental.Collections(config, tokenProvider);
this.datax = new io.weaviate.client.v1.experimental.DataClient(config, httpClient, tokenProvider, dbVersionSupport,
grpcVersionSupport, new Data(httpClient, config, dbVersionSupport));
}

public WeaviateAsyncClient async() {
Expand Down Expand Up @@ -87,10 +97,13 @@ public GraphQL graphQL() {
return new GraphQL(httpClient, config);
}

public GRPC gRPC() {
return new GRPC(httpClient, config, tokenProvider);
}

private DbVersionProvider initDbVersionProvider() {
MetaGetter metaGetter = new Misc(httpClient, config, null).metaGetter();
DbVersionProvider.VersionGetter getter = () ->
Optional.ofNullable(metaGetter.run())
DbVersionProvider.VersionGetter getter = () -> Optional.ofNullable(metaGetter.run())
.filter(result -> !result.hasErrors())
.map(result -> result.getResult().getVersion());

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/weaviate/client/base/BaseClient.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package io.weaviate.client.base;

import java.util.Collections;

import io.weaviate.client.Config;
import io.weaviate.client.base.http.HttpClient;
import io.weaviate.client.base.http.HttpResponse;
import java.util.Collections;

public abstract class BaseClient<T> {
private final HttpClient client;
private final Config config;
protected final Config config;
protected final Serializer serializer;

public BaseClient(HttpClient client, Config config) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.weaviate.client.base;

import java.util.ArrayList;
import java.util.List;

import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -14,5 +16,7 @@
public class WeaviateErrorResponse {
Integer code;
String message;
List<WeaviateErrorMessage> error;

@Builder.Default
List<WeaviateErrorMessage> error = new ArrayList<>();
}
8 changes: 7 additions & 1 deletion src/main/java/io/weaviate/client/base/grpc/GrpcClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.weaviate.client.base.grpc.base.BaseGrpcClient;
import io.weaviate.client.grpc.protocol.v1.WeaviateGrpc;
import io.weaviate.client.grpc.protocol.v1.WeaviateProtoBatch;
import io.weaviate.client.grpc.protocol.v1.WeaviateProtoSearchGet;
import io.weaviate.client.v1.auth.provider.AccessTokenProvider;
import lombok.AccessLevel;
import lombok.experimental.FieldDefaults;
Expand All @@ -25,6 +26,10 @@ public WeaviateProtoBatch.BatchObjectsReply batchObjects(WeaviateProtoBatch.Batc
return this.client.batchObjects(request);
}

public WeaviateProtoSearchGet.SearchReply search(WeaviateProtoSearchGet.SearchRequest request) {
return this.client.search(request);
}

public void shutdown() {
this.channel.shutdown();
}
Expand All @@ -33,7 +38,8 @@ public static GrpcClient create(Config config, AccessTokenProvider tokenProvider
Metadata headers = getHeaders(config, tokenProvider);
ManagedChannel channel = buildChannel(config);
WeaviateGrpc.WeaviateBlockingStub blockingStub = WeaviateGrpc.newBlockingStub(channel);
WeaviateGrpc.WeaviateBlockingStub client = blockingStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(headers));
WeaviateGrpc.WeaviateBlockingStub client = blockingStub
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(headers));
return new GrpcClient(client, channel);
}
}
Loading