Skip to content

Commit

Permalink
Fixed - RSearch aggregate expression applied incorrectly. #5800
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Koksharov committed Apr 22, 2024
1 parent 3b9508d commit 1db0b99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions redisson/src/main/java/org/redisson/RedissonSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ public RFuture<AggregationResult> aggregateAsync(String indexName, String query,
for (Expression expression : options.getExpressions()) {
args.add("APPLY");
args.add(expression.getValue());
args.add("AS");
args.add(expression.getAs());
}
if (options.getOffset() != null
Expand Down
15 changes: 15 additions & 0 deletions redisson/src/test/java/org/redisson/RedissonSearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ public void testMapAggregateWithCursor() {

}

@Test
public void testExpression() {
RSearch s = redisson.getSearch();
s.createIndex("idx", IndexOptions.defaults()
.on(IndexType.HASH)
.prefix(Arrays.asList("doc:")),
FieldIndex.text("t1"),
FieldIndex.text("t2"));

AggregationResult aggregate = s.aggregate("idx", "*", AggregationOptions.defaults()
.load("$.location", "as", "location", "$.*", "as", "$")
.apply(new Expression("geodistance(@location, 1, 2)", "dist"))
.limit(0, 1000));
}

@Test
public void testInfo() {
for (int i = 0; i < 1000; i++) {
Expand Down

0 comments on commit 1db0b99

Please sign in to comment.