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.
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(); + } +}