1- using System . Text ;
21using NRedisStack . Search ;
32using NRedisStack . Search . Aggregation ;
43using Xunit ;
@@ -285,7 +284,7 @@ public void Combine_DefaultLinear()
285284 {
286285 HybridSearchQuery query = new ( ) ;
287286 query . Combine ( HybridSearchQuery . Combiner . Linear ( ) ) ;
288- object [ ] expected = [ Index , "COMBINE" , "LINEAR" , 0 ] ;
287+ object [ ] expected = [ Index , "COMBINE" , "LINEAR" , 4 , "ALPHA" , 0.3 , "BETA" , 0.7 ] ;
289288 Assert . Equivalent ( expected , GetArgs ( query ) ) ;
290289 }
291290
@@ -304,7 +303,7 @@ public void Combine_DefaultRrf_WithAlias()
304303 {
305304 HybridSearchQuery query = new ( ) ;
306305 query . Combine ( HybridSearchQuery . Combiner . ReciprocalRankFusion ( ) , "my_combined_alias" ) ;
307- object [ ] expected = [ Index , "COMBINE" , "RRF" , 0 , "YIELD_SCORE_AS" , "my_combined_alias" ] ;
306+ object [ ] expected = [ Index , "COMBINE" , "RRF" , 2 , "WINDOW" , 20 , "YIELD_SCORE_AS" , "my_combined_alias" ] ;
308307 Assert . Equivalent ( expected , GetArgs ( query ) ) ;
309308 }
310309
@@ -317,11 +316,7 @@ public void Combine_NonDefaultRrf(int? window, double? constant)
317316 {
318317 HybridSearchQuery query = new ( ) ;
319318 query . Combine ( HybridSearchQuery . Combiner . ReciprocalRankFusion ( window , constant ) ) ;
320- object [ ] expected = [ Index , "COMBINE" , "RRF" , ( window is not null ? 2 : 0 ) + ( constant is not null ? 2 : 0 ) ] ;
321- if ( window is not null )
322- {
323- expected = [ .. expected , "WINDOW" , window ] ;
324- }
319+ object [ ] expected = [ Index , "COMBINE" , "RRF" , 2 + ( constant is not null ? 2 : 0 ) , "WINDOW" , window ?? 20 ] ;
325320
326321 if ( constant is not null )
327322 {
@@ -627,15 +622,18 @@ public void ParameterizedQuery()
627622 IReadOnlyDictionary < string , object > args = new Dictionary < string , object >
628623 {
629624 { "s" , "abc" } ,
630- { "v" , VectorData . Create ( SomeRandomDataHere ) }
625+ { "v" , VectorData . Create ( SomeRandomDataHere ) }
631626 } ;
632627 object [ ] expected = [ Index , "SEARCH" , "$s" , "VSIM" , "@field" , "$v" , "PARAMS" , 4 , "s" , "abc" , "v" , SomeRandomVectorValue ] ;
628+ var idx = Array . IndexOf ( expected , "abc" ) ;
629+ Assert . True ( idx >= 0 ) ;
633630 Assert . Equivalent ( expected , GetArgs ( query , args ) ) ;
634631
635632 // issue a second query against the same "query" instance, with different parameter values, this time from an object
636- args = Parameters . From ( new { s = "def" , v = SomeRandomDataHere } ) ;
637- expected [ 8 ] = "def" ; // update our expectations
638- expected [ 10 ] = SomeRandomVectorValue ;
633+ args = Parameters . From ( new { s = "def" , v = VectorData . Create ( SomeRandomDataHere ) } ) ;
634+
635+ expected [ idx ] = "def" ; // update our expectations
636+ expected [ idx + 2 ] = SomeRandomVectorValue ;
639637 Assert . Equivalent ( expected , GetArgs ( query , args ) ) ;
640638 }
641639
@@ -672,7 +670,7 @@ public void MakeMeOneWithEverything()
672670 "QUANTILE" , 2 , "@field3" , 0.5 , "AS" , "reducer_alias" , "APPLY" , "@field1 + @field2" , "AS" , "apply_alias" ,
673671 "SORTBY" , 3 , "field1" , "field2" , "DESC" , "FILTER" , "@field1:bar" , "LIMIT" , 12 , 54 ,
674672 "PARAMS" , 4 , "x" , 42 , "y" , "abc" ,
675- "EXPLAINSCORE" , "TIMEOUT" ,
673+ "EXPLAINSCORE" , "TIMEOUT" , 1000 ,
676674 "WITHCURSOR" , "COUNT" , 10 , "MAXIDLE" , 10000
677675 ] ;
678676
0 commit comments