@@ -1684,7 +1684,6 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
1684
1684
Expect (resUint8 .Docs [0 ].ID ).To (BeEquivalentTo ("doc1" ))
1685
1685
})
1686
1686
1687
- << << << < HEAD
1688
1687
It ("should fail when using a non-zero offset with a zero limit" , Label ("search" , "ftsearch" ), func () {
1689
1688
SkipBeforeRedisVersion (7.9 , "requires Redis 8.x" )
1690
1689
val , err := client .FTCreate (ctx , "testIdx" , & redis.FTCreateOptions {}, & redis.FieldSchema {
@@ -2106,6 +2105,99 @@ var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
2106
2105
Expect (len (resLimit .Docs )).To (BeEquivalentTo (2 ))
2107
2106
})
2108
2107
2108
+ It ("should reject deprecated configuration keys" , Label ("search" , "ftconfig" ), func () {
2109
+ SkipBeforeRedisVersion (7.9 , "requires Redis 8.x" )
2110
+ // List of deprecated configuration keys.
2111
+ deprecatedKeys := []string {
2112
+ "_FREE_RESOURCE_ON_THREAD" ,
2113
+ "_NUMERIC_COMPRESS" ,
2114
+ "_NUMERIC_RANGES_PARENTS" ,
2115
+ "_PRINT_PROFILE_CLOCK" ,
2116
+ "_PRIORITIZE_INTERSECT_UNION_CHILDREN" ,
2117
+ "BG_INDEX_SLEEP_GAP" ,
2118
+ "CONN_PER_SHARD" ,
2119
+ "CURSOR_MAX_IDLE" ,
2120
+ "CURSOR_REPLY_THRESHOLD" ,
2121
+ "DEFAULT_DIALECT" ,
2122
+ "EXTLOAD" ,
2123
+ "FORK_GC_CLEAN_THRESHOLD" ,
2124
+ "FORK_GC_RETRY_INTERVAL" ,
2125
+ "FORK_GC_RUN_INTERVAL" ,
2126
+ "FORKGC_SLEEP_BEFORE_EXIT" ,
2127
+ "FRISOINI" ,
2128
+ "GC_POLICY" ,
2129
+ "GCSCANSIZE" ,
2130
+ "INDEX_CURSOR_LIMIT" ,
2131
+ "MAXAGGREGATERESULTS" ,
2132
+ "MAXDOCTABLESIZE" ,
2133
+ "MAXPREFIXEXPANSIONS" ,
2134
+ "MAXSEARCHRESULTS" ,
2135
+ "MIN_OPERATION_WORKERS" ,
2136
+ "MIN_PHONETIC_TERM_LEN" ,
2137
+ "MINPREFIX" ,
2138
+ "MINSTEMLEN" ,
2139
+ "NO_MEM_POOLS" ,
2140
+ "NOGC" ,
2141
+ "ON_TIMEOUT" ,
2142
+ "MULTI_TEXT_SLOP" ,
2143
+ "PARTIAL_INDEXED_DOCS" ,
2144
+ "RAW_DOCID_ENCODING" ,
2145
+ "SEARCH_THREADS" ,
2146
+ "TIERED_HNSW_BUFFER_LIMIT" ,
2147
+ "TIMEOUT" ,
2148
+ "TOPOLOGY_VALIDATION_TIMEOUT" ,
2149
+ "UNION_ITERATOR_HEAP" ,
2150
+ "VSS_MAX_RESIZE" ,
2151
+ "WORKERS" ,
2152
+ "WORKERS_PRIORITY_BIAS_THRESHOLD" ,
2153
+ "MT_MODE" ,
2154
+ "WORKER_THREADS" ,
2155
+ }
2156
+
2157
+ for _ , key := range deprecatedKeys {
2158
+ _ , err := client .FTConfigSet (ctx , key , "test_value" ).Result ()
2159
+ Expect (err ).To (HaveOccurred ())
2160
+ }
2161
+
2162
+ val , err := client .ConfigGet (ctx , "*" ).Result ()
2163
+ Expect (err ).NotTo (HaveOccurred ())
2164
+ // Since FT.CONFIG is deprecated since redis 8, use CONFIG instead with new search parameters.
2165
+ keys := make ([]string , 0 , len (val ))
2166
+ for key := range val {
2167
+ keys = append (keys , key )
2168
+ }
2169
+ Expect (keys ).To (ContainElement (ContainSubstring ("search" )))
2170
+ })
2171
+
2172
+ It ("should return INF for MIN reducer and -INF for MAX reducer when no numeric values are present" , Label ("search" , "ftaggregate" ), func () {
2173
+ SkipBeforeRedisVersion (7.9 , "requires Redis 8.x" )
2174
+ val , err := client .FTCreate (ctx , "aggTestMinMax" , & redis.FTCreateOptions {},
2175
+ & redis.FieldSchema {FieldName : "grp" , FieldType : redis .SearchFieldTypeText },
2176
+ & redis.FieldSchema {FieldName : "n" , FieldType : redis .SearchFieldTypeNumeric },
2177
+ ).Result ()
2178
+ Expect (err ).NotTo (HaveOccurred ())
2179
+ Expect (val ).To (BeEquivalentTo ("OK" ))
2180
+ WaitForIndexing (client , "aggTestMinMax" )
2181
+
2182
+ _ , err = client .HSet (ctx , "doc1" , "grp" , "g1" ).Result ()
2183
+ Expect (err ).NotTo (HaveOccurred ())
2184
+
2185
+ reducers := []redis.FTAggregateReducer {
2186
+ {Reducer : redis .SearchMin , Args : []interface {}{"@n" }, As : "minValue" },
2187
+ {Reducer : redis .SearchMax , Args : []interface {}{"@n" }, As : "maxValue" },
2188
+ }
2189
+ groupBy := []redis.FTAggregateGroupBy {
2190
+ {Fields : []interface {}{"@grp" }, Reduce : reducers },
2191
+ }
2192
+ options := & redis.FTAggregateOptions {GroupBy : groupBy }
2193
+ res , err := client .FTAggregateWithArgs (ctx , "aggTestMinMax" , "*" , options ).Result ()
2194
+ Expect (err ).NotTo (HaveOccurred ())
2195
+ Expect (res .Rows ).ToNot (BeEmpty ())
2196
+
2197
+ Expect (res .Rows [0 ].Fields ["minValue" ]).To (BeEquivalentTo ("inf" ))
2198
+ Expect (res .Rows [0 ].Fields ["maxValue" ]).To (BeEquivalentTo ("-inf" ))
2199
+ })
2200
+
2109
2201
})
2110
2202
2111
2203
func _assert_geosearch_result (result * redis.FTSearchResult , expectedDocIDs []string ) {
0 commit comments