|
19 | 19 | import io.qdrant.client.grpc.Common.Range; |
20 | 20 | import io.qdrant.client.grpc.Common.RepeatedIntegers; |
21 | 21 | import io.qdrant.client.grpc.Common.RepeatedStrings; |
| 22 | +import io.qdrant.client.grpc.Common.SliceCondition; |
22 | 23 | import io.qdrant.client.grpc.Common.ValuesCount; |
23 | 24 | import java.util.List; |
24 | 25 |
|
@@ -142,6 +143,25 @@ public static Condition matchTextAny(String field, String textAny) { |
142 | 143 | .build(); |
143 | 144 | } |
144 | 145 |
|
| 146 | + /** |
| 147 | + * Match records where the given field starts with the given keyword prefix. |
| 148 | + * |
| 149 | + * <p>The field must have a keyword index with prefix matching enabled. |
| 150 | + * |
| 151 | + * @param field The name of the field |
| 152 | + * @param prefix The keyword prefix to match |
| 153 | + * @return a new instance of {@link Condition} |
| 154 | + */ |
| 155 | + public static Condition matchPrefix(String field, String prefix) { |
| 156 | + return Condition.newBuilder() |
| 157 | + .setField( |
| 158 | + FieldCondition.newBuilder() |
| 159 | + .setKey(field) |
| 160 | + .setMatch(Match.newBuilder().setPrefix(prefix).build()) |
| 161 | + .build()) |
| 162 | + .build(); |
| 163 | + } |
| 164 | + |
145 | 165 | /** |
146 | 166 | * Match records where the given field matches the given boolean value. |
147 | 167 | * |
@@ -427,6 +447,19 @@ public static Condition datetimeRange(String field, DatetimeRange datetimeRange) |
427 | 447 | .build(); |
428 | 448 | } |
429 | 449 |
|
| 450 | + /** |
| 451 | + * Selects one deterministic slice of the point ID space. |
| 452 | + * |
| 453 | + * @param total The total number of disjoint slices. Must be at least 1 |
| 454 | + * @param index The slice to select. Must be less than {@code total} |
| 455 | + * @return a new instance of {@link Condition} |
| 456 | + */ |
| 457 | + public static Condition slice(int total, int index) { |
| 458 | + return Condition.newBuilder() |
| 459 | + .setSlice(SliceCondition.newBuilder().setTotal(total).setIndex(index).build()) |
| 460 | + .build(); |
| 461 | + } |
| 462 | + |
430 | 463 | /** |
431 | 464 | * Matches records where a value for the given vector is present. |
432 | 465 | * |
|
0 commit comments