Skip to content

Commit

Permalink
Add withPartitionName for DeleteIdsParam
Browse files Browse the repository at this point in the history
Signed-off-by: yhmo <[email protected]>
  • Loading branch information
yhmo committed Dec 20, 2023
1 parent 2551080 commit 04cf934
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3076,6 +3076,7 @@ public R<DeleteResponse> delete(DeleteIdsParam requestParam) {
String expr = VectorUtils.convertPksExpr(requestParam.getPrimaryIds(), wrapper);
DeleteParam deleteParam = DeleteParam.newBuilder()
.withCollectionName(requestParam.getCollectionName())
.withPartitionName(requestParam.getPartitionName())
.withExpr(expr)
.build();
R<MutationResult> resultR = delete(deleteParam);
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/io/milvus/param/highlevel/dml/DeleteIdsParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
@Getter
@ToString
public class DeleteIdsParam {

private final String collectionName;
private final String partitionName;
private final List<?> primaryIds;

private DeleteIdsParam(@NonNull Builder builder) {
this.collectionName = builder.collectionName;
this.partitionName = builder.partitionName;
this.primaryIds = builder.primaryIds;
}

Expand All @@ -54,6 +55,7 @@ public static Builder newBuilder() {
*/
public static class Builder<T> {
private String collectionName;
private String partitionName = "";
private List<T> primaryIds = new ArrayList<>();

private Builder() {
Expand All @@ -70,6 +72,17 @@ public Builder withCollectionName(@NonNull String collectionName) {
return this;
}

/**
* Sets the partition name (Optional).
*
* @param partitionName partition name
* @return <code>Builder</code>
*/
public Builder withPartitionName(@NonNull String partitionName) {
this.partitionName = partitionName;
return this;
}

/**
* Specifies primaryId fields. PrimaryIds cannot be empty or null.
*
Expand Down

0 comments on commit 04cf934

Please sign in to comment.