Skip to content

Commit 91fe45d

Browse files
committed
feat: add Target to aggregate-nearText queries
1 parent 593dcc9 commit 91fe45d

File tree

1 file changed

+93
-9
lines changed

1 file changed

+93
-9
lines changed

src/main/java/io/weaviate/client6/v1/api/collections/aggregate/AbstractAggregateClient.java

Lines changed: 93 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,21 @@ public ResponseT nearText(List<String> concepts, Function<Aggregation.Builder, O
675675
return nearText(NearText.of(Target.text(concepts)), fn);
676676
}
677677

678+
/**
679+
* Aggregate results of a near text query.
680+
*
681+
* @param searchTarget Query target.
682+
* @param fn Lambda expression for optional aggregation parameters.
683+
* @return Aggregation result.
684+
*
685+
* @throws WeaviateApiException in case the server returned with an
686+
* error status code.
687+
* @see AggregateResponse
688+
*/
689+
public ResponseT nearText(Target searchTarget, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
690+
return nearText(NearText.of(searchTarget), fn);
691+
}
692+
678693
/**
679694
* Aggregate results of a near text query.
680695
*
@@ -687,7 +702,8 @@ public ResponseT nearText(List<String> concepts, Function<Aggregation.Builder, O
687702
* error status code.
688703
* @see AggregateResponse
689704
*/
690-
public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
705+
public ResponseT nearText(String text,
706+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
691707
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
692708
return nearText(NearText.of(Target.text(List.of(text)), nt), fn);
693709
}
@@ -704,11 +720,30 @@ public ResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<
704720
* error status code.
705721
* @see AggregateResponse
706722
*/
707-
public ResponseT nearText(List<String> concepts, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
723+
public ResponseT nearText(List<String> concepts,
724+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
708725
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
709726
return nearText(NearText.of(Target.text(concepts), nt), fn);
710727
}
711728

729+
/**
730+
* Aggregate results of a near text query.
731+
*
732+
* @param searchTarget Query target.
733+
* @param nt Lambda expression for optional near text parameters.
734+
* @param fn Lambda expression for optional aggregation parameters.
735+
* @return Aggregation result.
736+
*
737+
* @throws WeaviateApiException in case the server returned with an
738+
* error status code.
739+
* @see AggregateResponse
740+
*/
741+
public ResponseT nearText(Target searchTarget,
742+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
743+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
744+
return nearText(NearText.of(searchTarget, nt), fn);
745+
}
746+
712747
/**
713748
* Aggregate results of a near text query.
714749
*
@@ -719,7 +754,8 @@ public ResponseT nearText(List<String> concepts, Function<NearText.Builder, Obje
719754
* @throws WeaviateApiException in case the server returned with an
720755
* error status code.
721756
*/
722-
public ResponseT nearText(NearText filter, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
757+
public ResponseT nearText(NearText filter,
758+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn) {
723759
return performRequest(Aggregation.of(filter, fn));
724760
}
725761

@@ -737,7 +773,8 @@ public ResponseT nearText(NearText filter, Function<Aggregation.Builder, ObjectB
737773
* @see GroupBy
738774
* @see AggregateResponseGrouped
739775
*/
740-
public GroupedResponseT nearText(String text, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
776+
public GroupedResponseT nearText(String text,
777+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
741778
GroupBy groupBy) {
742779
return nearText(NearText.of(text), fn, groupBy);
743780
}
@@ -756,11 +793,32 @@ public GroupedResponseT nearText(String text, Function<Aggregation.Builder, Obje
756793
* @see GroupBy
757794
* @see AggregateResponseGrouped
758795
*/
759-
public GroupedResponseT nearText(List<String> concepts, Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
796+
public GroupedResponseT nearText(List<String> concepts,
797+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
760798
GroupBy groupBy) {
761799
return nearText(NearText.of(Target.text(concepts)), fn, groupBy);
762800
}
763801

802+
/**
803+
* Aggregate results of a near text query.
804+
*
805+
* @param searchTarget Query target.
806+
* @param fn Lambda expression for optional aggregation parameters.
807+
* @param groupBy GroupBy clause.
808+
* @return Grouped aggregation result.
809+
*
810+
* @throws WeaviateApiException in case the server returned with an
811+
* error status code.
812+
*
813+
* @see GroupBy
814+
* @see AggregateResponseGrouped
815+
*/
816+
public GroupedResponseT nearText(Target searchTarget,
817+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
818+
GroupBy groupBy) {
819+
return nearText(NearText.of(searchTarget), fn, groupBy);
820+
}
821+
764822
/**
765823
* Aggregate results of a near text query.
766824
*
@@ -776,8 +834,10 @@ public GroupedResponseT nearText(List<String> concepts, Function<Aggregation.Bui
776834
* @see GroupBy
777835
* @see AggregateResponseGrouped
778836
*/
779-
public GroupedResponseT nearText(String text, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
780-
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn, GroupBy groupBy) {
837+
public GroupedResponseT nearText(String text,
838+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
839+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
840+
GroupBy groupBy) {
781841
return nearText(NearText.of(text, nt), fn, groupBy);
782842
}
783843

@@ -796,11 +856,35 @@ public GroupedResponseT nearText(String text, Function<NearText.Builder, ObjectB
796856
* @see GroupBy
797857
* @see AggregateResponseGrouped
798858
*/
799-
public GroupedResponseT nearText(List<String> concepts, Function<NearText.Builder, ObjectBuilder<NearText>> nt,
800-
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn, GroupBy groupBy) {
859+
public GroupedResponseT nearText(List<String> concepts,
860+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
861+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
862+
GroupBy groupBy) {
801863
return nearText(NearText.of(Target.text(concepts), nt), fn, groupBy);
802864
}
803865

866+
/**
867+
* Aggregate results of a near text query.
868+
*
869+
* @param searchTarget Query target.
870+
* @param nt Lambda expression for optional near text parameters.
871+
* @param fn Lambda expression for optional aggregation parameters.
872+
* @param groupBy GroupBy clause.
873+
* @return Grouped aggregation result.
874+
*
875+
* @throws WeaviateApiException in case the server returned with an
876+
* error status code.
877+
*
878+
* @see GroupBy
879+
* @see AggregateResponseGrouped
880+
*/
881+
public GroupedResponseT nearText(Target searchTarget,
882+
Function<NearText.Builder, ObjectBuilder<NearText>> nt,
883+
Function<Aggregation.Builder, ObjectBuilder<Aggregation>> fn,
884+
GroupBy groupBy) {
885+
return nearText(NearText.of(searchTarget, nt), fn, groupBy);
886+
}
887+
804888
/**
805889
* Aggregate results of a near text query.
806890
*

0 commit comments

Comments
 (0)