Skip to content

Commit 3dbe975

Browse files
committed
feat: allow overAll aggregation with only the GroupBy argument
1 parent fb7b25c commit 3dbe975

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ public ResponseT overAll(Function<Aggregation.Builder, ObjectBuilder<Aggregation
6060
return performRequest(Aggregation.of(fn));
6161
}
6262

63+
/**
64+
* Aggregate metrics over all objects in this collection.
65+
*
66+
* @param groupBy GroupBy clause.
67+
* @return Grouped aggregation result.
68+
*
69+
* @throws WeaviateApiException in case the server returned with an
70+
* error status code.
71+
*
72+
* @see GroupBy
73+
* @see AggregateResponseGrouped
74+
*/
75+
public GroupedResponseT overAll(GroupBy groupBy) {
76+
return performRequest(Aggregation.of(), groupBy);
77+
}
78+
6379
/**
6480
* Aggregate metrics over all objects in this collection.
6581
*

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public record Aggregation(
1414
boolean includeTotalCount,
1515
List<PropertyAggregation> returnMetrics) {
1616

17+
public static Aggregation of() {
18+
return of(AggregateObjectFilter.NONE, ObjectBuilder.identity());
19+
}
20+
1721
public static Aggregation of(Function<Builder, ObjectBuilder<Aggregation>> fn) {
1822
return of(AggregateObjectFilter.NONE, fn);
1923
}

0 commit comments

Comments
 (0)