Skip to content

Commit 305aaf8

Browse files
committed
test(multivector): Update unit test to expect @ prefix in scoring formula
Fixed MultiVectorQueryTest to expect the correct Redis aggregation syntax with @ prefix. The scoring formula needs @ prefix when referencing fields created by APPLY in Redis aggregation queries. Updated test assertion from "0.20 * score_0" to "0.20 * @score_0" to match the actual implementation required for proper FT.AGGREGATE execution.
1 parent 10c103d commit 305aaf8

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

core/src/main/java/com/redis/vl/query/MultiVectorQuery.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,13 @@ public Map<String, Object> getParams() {
181181
* Build the Redis AggregationBuilder for multi-vector search.
182182
*
183183
* <p>Creates an aggregation pipeline with:
184+
*
184185
* <ul>
185-
* <li>LOAD all return fields</li>
186-
* <li>APPLY score calculations for each vector: score_i = (2 - distance_i) / 2</li>
187-
* <li>APPLY final combined score: w_1 * score_1 + w_2 * score_2 + ...</li>
188-
* <li>SORTBY combined_score DESC</li>
189-
* <li>LIMIT numResults</li>
186+
* <li>LOAD all return fields
187+
* <li>APPLY score calculations for each vector: score_i = (2 - distance_i) / 2
188+
* <li>APPLY final combined score: w_1 * score_1 + w_2 * score_2 + ...
189+
* <li>SORTBY combined_score DESC
190+
* <li>LIMIT numResults
190191
* </ul>
191192
*
192193
* @return Configured AggregationBuilder

core/src/test/java/com/redis/vl/query/MultiVectorQueryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ void testMultiVectorQueryScoringFormula() {
289289

290290
String formula = query.getScoringFormula();
291291

292-
// Expected: "0.20 * score_0 + 0.70 * score_1"
293-
assertThat(formula).contains("0.20 * score_0").contains("0.70 * score_1").contains(" + ");
292+
// Expected: "0.20 * @score_0 + 0.70 * @score_1" (@ prefix required for Redis aggregation)
293+
assertThat(formula).contains("0.20 * @score_0").contains("0.70 * @score_1").contains(" + ");
294294
}
295295

296296
@Test

0 commit comments

Comments
 (0)