diff --git a/README.md b/README.md index 8134ae8..d417bd1 100644 --- a/README.md +++ b/README.md @@ -38,20 +38,20 @@ To install the library, add the following lines to your build config file. io.qdrant client - 1.18.3 + 1.19.0 ``` #### SBT ```sbt -libraryDependencies += "io.qdrant" % "client" % "1.18.3" +libraryDependencies += "io.qdrant" % "client" % "1.19.0" ``` #### Gradle ```gradle -implementation 'io.qdrant:client:1.18.3' +implementation 'io.qdrant:client:1.19.0' ``` > [!NOTE] diff --git a/example/build.gradle b/example/build.gradle index 1952c13..c9780ab 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -13,7 +13,7 @@ repositories { dependencies { // Qdrant Java client - implementation 'io.qdrant:client:1.18.3' + implementation 'io.qdrant:client:1.19.0' // gRPC dependencies - use the same version as Qdrant client implementation 'io.grpc:grpc-netty-shaded:1.65.1' diff --git a/gradle.properties b/gradle.properties index dc0b8fe..5358052 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ # The version of qdrant to use to download protos -qdrantProtosVersion=v1.18.0 +qdrantProtosVersion=dev # The version of qdrant docker image to run integration tests against -qdrantVersion=v1.18.0 +qdrantVersion=dev # The version of the client to generate -packageVersion=1.18.3 +packageVersion=1.19.0 diff --git a/src/main/java/io/qdrant/client/ConditionFactory.java b/src/main/java/io/qdrant/client/ConditionFactory.java index d9a04bf..40c6a36 100644 --- a/src/main/java/io/qdrant/client/ConditionFactory.java +++ b/src/main/java/io/qdrant/client/ConditionFactory.java @@ -19,6 +19,7 @@ import io.qdrant.client.grpc.Common.Range; import io.qdrant.client.grpc.Common.RepeatedIntegers; import io.qdrant.client.grpc.Common.RepeatedStrings; +import io.qdrant.client.grpc.Common.SliceCondition; import io.qdrant.client.grpc.Common.ValuesCount; import java.util.List; @@ -142,6 +143,25 @@ public static Condition matchTextAny(String field, String textAny) { .build(); } + /** + * Match records where the given field starts with the given keyword prefix. + * + *

The field must have a keyword index with prefix matching enabled. + * + * @param field The name of the field + * @param prefix The keyword prefix to match + * @return a new instance of {@link Condition} + */ + public static Condition matchPrefix(String field, String prefix) { + return Condition.newBuilder() + .setField( + FieldCondition.newBuilder() + .setKey(field) + .setMatch(Match.newBuilder().setPrefix(prefix).build()) + .build()) + .build(); + } + /** * Match records where the given field matches the given boolean value. * @@ -427,6 +447,19 @@ public static Condition datetimeRange(String field, DatetimeRange datetimeRange) .build(); } + /** + * Selects one deterministic slice of the point ID space. + * + * @param total The total number of disjoint slices. Must be at least 1 + * @param index The slice to select. Must be less than {@code total} + * @return a new instance of {@link Condition} + */ + public static Condition slice(int total, int index) { + return Condition.newBuilder() + .setSlice(SliceCondition.newBuilder().setTotal(total).setIndex(index).build()) + .build(); + } + /** * Matches records where a value for the given vector is present. * diff --git a/src/main/java/io/qdrant/client/StemmingAlgorithmFactory.java b/src/main/java/io/qdrant/client/StemmingAlgorithmFactory.java new file mode 100644 index 0000000..3964e42 --- /dev/null +++ b/src/main/java/io/qdrant/client/StemmingAlgorithmFactory.java @@ -0,0 +1,31 @@ +package io.qdrant.client; + +import io.qdrant.client.grpc.Collections.DisabledStemmer; +import io.qdrant.client.grpc.Collections.SnowballParams; +import io.qdrant.client.grpc.Collections.StemmingAlgorithm; + +/** Convenience methods for constructing {@link StemmingAlgorithm}. */ +public final class StemmingAlgorithmFactory { + private StemmingAlgorithmFactory() {} + + /** + * Creates a Snowball stemming algorithm for the given language. + * + * @param language The language whose words should be stemmed + * @return a new instance of {@link StemmingAlgorithm} + */ + public static StemmingAlgorithm snowball(String language) { + return StemmingAlgorithm.newBuilder() + .setSnowball(SnowballParams.newBuilder().setLanguage(language).build()) + .build(); + } + + /** + * Explicitly disables stemming, overriding the language default. + * + * @return a new instance of {@link StemmingAlgorithm} + */ + public static StemmingAlgorithm disabled() { + return StemmingAlgorithm.newBuilder().setDisabled(DisabledStemmer.getDefaultInstance()).build(); + } +}