Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.weaviate.client6.v1.api.collections.query.NearThermal;
import io.weaviate.client6.v1.api.collections.query.NearVector;
import io.weaviate.client6.v1.api.collections.query.NearVideo;
import io.weaviate.client6.v1.api.collections.query.Target;
import io.weaviate.client6.v1.internal.ObjectBuilder;
import io.weaviate.client6.v1.internal.grpc.GrpcTransport;
import io.weaviate.client6.v1.internal.orm.CollectionDescriptor;
Expand Down Expand Up @@ -197,7 +198,7 @@ public GroupedResponseT hybrid(Hybrid filter, Function<Aggregation.Builder, Obje
* @see AggregateResponse
*/
public ResponseT nearVector(float[] vector, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
return nearVector(NearVector.of(vector), fn);
return nearVector(NearVector.of(Target.vector(vector)), fn);
}

/**
Expand All @@ -214,7 +215,7 @@ public ResponseT nearVector(float[] vector, Function<Aggregation.Builder, Object
*/
public ResponseT nearVector(float[] vector, Function<NearVector.Builder, ObjectBuilder<NearVector>> nv,
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
return nearVector(NearVector.of(vector, nv), fn);
return nearVector(NearVector.of(Target.vector(vector), nv), fn);
}

/**
Expand Down Expand Up @@ -248,7 +249,7 @@ public ResponseT nearVector(NearVector filter, Function<Aggregation.Builder, Obj
*/
public GroupedResponseT nearVector(float[] vector, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
GroupBy groupBy) {
return nearVector(NearVector.of(vector), fn, groupBy);
return nearVector(NearVector.of(Target.vector(vector)), fn, groupBy);
}

/**
Expand All @@ -268,7 +269,7 @@ public GroupedResponseT nearVector(float[] vector, Function<Aggregation.Builder,
*/
public GroupedResponseT nearVector(float[] vector, Function<NearVector.Builder, ObjectBuilder<NearVector>> nv,
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn, GroupBy groupBy) {
return nearVector(NearVector.of(vector, nv), fn, groupBy);
return nearVector(NearVector.of(Target.vector(vector), nv), fn, groupBy);
}

/**
Expand Down Expand Up @@ -426,7 +427,7 @@ public ResponseT nearText(String text, Function<Aggregation.Builder, ObjectBuild
* @see AggregateResponse
*/
public ResponseT nearText(List<String> concepts, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
return nearText(NearText.of(concepts), fn);
return nearText(NearText.of(Target.text(concepts)), fn);
}

/**
Expand All @@ -443,7 +444,7 @@ public ResponseT nearText(List<String> concepts, Function<Aggregation.Builder, O
*/
public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
return nearText(NearText.of(text, nt), fn);
return nearText(NearText.of(Target.text(List.of(text)), nt), fn);
}

/**
Expand All @@ -460,7 +461,7 @@ public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<
*/
public ResponseT nearText(List<String> concepts, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
return nearText(NearText.of(concepts, nt), fn);
return nearText(NearText.of(Target.text(concepts), nt), fn);
}

/**
Expand Down Expand Up @@ -512,7 +513,7 @@ public GroupedResponseT nearText(String text, Function<Aggregation.Builder, Obje
*/
public GroupedResponseT nearText(List<String> concepts, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
GroupBy groupBy) {
return nearText(NearText.of(concepts), fn, groupBy);
return nearText(NearText.of(Target.text(concepts)), fn, groupBy);
}

/**
Expand Down Expand Up @@ -552,7 +553,7 @@ public GroupedResponseT nearText(String text, Function<NearText.Builder, ObjectB
*/
public GroupedResponseT nearText(List<String> concepts, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn, GroupBy groupBy) {
return nearText(NearText.of(concepts, nt), fn, groupBy);
return nearText(NearText.of(Target.text(concepts), nt), fn, groupBy);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.weaviate.client6.v1.api.collections.CollectionHandleDefaults;
import io.weaviate.client6.v1.api.collections.ObjectMetadata;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
import io.weaviate.client6.v1.internal.Debug;
import io.weaviate.client6.v1.internal.MapUtil;
import io.weaviate.client6.v1.internal.grpc.ByteStringUtil;
import io.weaviate.client6.v1.internal.grpc.Rpc;
Expand Down Expand Up @@ -162,8 +161,6 @@ public static <T> void buildObject(WeaviateProtoBatch.BatchObject.Builder object
.setNonRefProperties(nonRef)
.addAllSingleTargetRefProps(singleRef)
.addAllMultiTargetRefProps(multiRef));

Debug.printProto(object);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.weaviate.client6.v1.api.collections.query;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -317,7 +318,7 @@ public GroupedResponseT hybrid(Hybrid query, GroupBy groupBy) {
* error status code.
*/
public ResponseT nearVector(float[] vector) {
return nearVector(NearVector.of(vector));
return nearVector(Target.vector(vector));
}

/**
Expand All @@ -329,7 +330,31 @@ public ResponseT nearVector(float[] vector) {
* error status code.
*/
public ResponseT nearVector(float[] vector, Function<NearVector.Builder, ObjectBuilder<NearVector>> fn) {
return nearVector(NearVector.of(vector, fn));
return nearVector(Target.vector(vector), fn);
}

/**
* Query collection objects using near vector search.
*
* @param searchTarget Target query vectors.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*/
public ResponseT nearVector(NearVectorTarget searchTarget) {
return performRequest(NearVector.of(searchTarget));
}

/**
* Query collection objects using near vector search.
*
* @param searchTarget Target query vectors.
* @param fn Lambda expression for optional parameters.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*/
public ResponseT nearVector(NearVectorTarget searchTarget,
Function<NearVector.Builder, ObjectBuilder<NearVector>> fn) {
return performRequest(NearVector.of(searchTarget, fn));
}

/**
Expand All @@ -356,7 +381,7 @@ public ResponseT nearVector(NearVector query) {
* @see QueryResponseGrouped
*/
public GroupedResponseT nearVector(float[] vector, GroupBy groupBy) {
return nearVector(NearVector.of(vector), groupBy);
return nearVector(Target.vector(vector), groupBy);
}

/**
Expand All @@ -374,7 +399,42 @@ public GroupedResponseT nearVector(float[] vector, GroupBy groupBy) {
*/
public GroupedResponseT nearVector(float[] vector, Function<NearVector.Builder, ObjectBuilder<NearVector>> fn,
GroupBy groupBy) {
return nearVector(NearVector.of(vector, fn), groupBy);
return nearVector(Target.vector(vector), fn, groupBy);
}

/**
* Query collection objects using near vector search.
*
* @param searchTarget Target query vectors.
* @param groupBy Group-by clause.
* @return Grouped query result.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearVector(NearVectorTarget searchTarget,
GroupBy groupBy) {
return performRequest(NearVector.of(searchTarget), groupBy);
}

/**
* Query collection objects using near vector search.
*
* @param searchTarget Target query vectors.
* @param fn Lambda expression for optional parameters.
* @return Grouped query result.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearVector(NearVectorTarget searchTarget,
Function<NearVector.Builder, ObjectBuilder<NearVector>> fn,
GroupBy groupBy) {
return performRequest(NearVector.of(searchTarget, fn), groupBy);
}

/**
Expand Down Expand Up @@ -489,7 +549,7 @@ public GroupedResponseT nearObject(NearObject query, GroupBy groupBy) {
* error status code.
*/
public ResponseT nearText(String... text) {
return nearText(NearText.of(text));
return nearText(Target.text(Arrays.asList(text)));
}

/**
Expand All @@ -501,7 +561,7 @@ public ResponseT nearText(String... text) {
* error status code.
*/
public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<NearText>> fn) {
return nearText(NearText.of(text, fn));
return nearText(Target.text(List.of(text)), fn);
}

/**
Expand All @@ -513,7 +573,30 @@ public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<
* error status code.
*/
public ResponseT nearText(List<String> text, Function<NearText.Builder, ObjectBuilder<NearText>> fn) {
return nearText(NearText.of(text, fn));
return nearText(Target.text(text), fn);
}

/**
* Query collection objects using near text search.
*
* @param searchTarget Target query concepts.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*/
public ResponseT nearText(Target searchTarget) {
return nearText(NearText.of(searchTarget));
}

/**
* Query collection objects using near text search.
*
* @param searchTarget Target query concepts.
* @param fn Lambda expression for optional parameters.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*/
public ResponseT nearText(Target searchTarget, Function<NearText.Builder, ObjectBuilder<NearText>> fn) {
return nearText(NearText.of(searchTarget, fn));
}

/**
Expand All @@ -540,7 +623,7 @@ public ResponseT nearText(NearText query) {
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(String text, GroupBy groupBy) {
return nearText(NearText.of(text), groupBy);
return nearText(Target.text(List.of(text)), groupBy);
}

/**
Expand All @@ -556,7 +639,7 @@ public GroupedResponseT nearText(String text, GroupBy groupBy) {
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(List<String> text, GroupBy groupBy) {
return nearText(NearText.of(text), groupBy);
return nearText(Target.text(text), groupBy);
}

/**
Expand All @@ -572,9 +655,10 @@ public GroupedResponseT nearText(List<String> text, GroupBy groupBy) {
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<NearText>> fn,
public GroupedResponseT nearText(String text,
Function<NearText.Builder, ObjectBuilder<NearText>> fn,
GroupBy groupBy) {
return nearText(NearText.of(text), groupBy);
return nearText(Target.text(List.of(text)), fn, groupBy);
}

/**
Expand All @@ -590,9 +674,45 @@ public GroupedResponseT nearText(String text, Function<NearText.Builder, ObjectB
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(List<String> text, Function<NearText.Builder, ObjectBuilder<NearText>> fn,
public GroupedResponseT nearText(List<String> text,
Function<NearText.Builder, ObjectBuilder<NearText>> fn,
GroupBy groupBy) {
return nearText(Target.text(text), groupBy);
}

/**
* Query collection objects using near text search.
*
* @param searchTarget Target query concepts.
* @param groupBy Group-by clause.
* @return Grouped query result.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(Target searchTarget, GroupBy groupBy) {
return nearText(NearText.of(searchTarget), groupBy);
}

/**
* Query collection objects using near text search.
*
* @param searchTarget Target query concepts.
* @param fn Lambda expression for optional parameters.
* @param groupBy Group-by clause.
* @return Grouped query result.
* @throws WeaviateApiException in case the server returned with an
* error status code.
*
* @see GroupBy
* @see QueryResponseGrouped
*/
public GroupedResponseT nearText(Target searchTarget,
Function<NearText.Builder, ObjectBuilder<NearText>> fn,
GroupBy groupBy) {
return nearText(NearText.of(text), groupBy);
return nearText(NearText.of(searchTarget, fn), groupBy);
}

/**
Expand Down
Loading