@@ -2041,6 +2041,8 @@ def test_json_with_jsonpath(client):
20412041@pytest .mark .redismod
20422042@pytest .mark .onlynoncluster
20432043@skip_if_redis_enterprise ()
2044+ @skip_if_server_version_gte ("7.9.0" )
2045+ @skip_if_server_version_lt ("6.3.0" )
20442046def test_profile (client ):
20452047 client .ft ().create_index ((TextField ("t" ),))
20462048 client .ft ().client .hset ("1" , "t" , "hello" )
@@ -2091,6 +2093,96 @@ def test_profile(client):
20912093
20922094@pytest .mark .redismod
20932095@pytest .mark .onlynoncluster
2096+ @skip_if_redis_enterprise ()
2097+ @skip_if_server_version_lt ("7.9.0" )
2098+ def test_profile_with_coordinator (client ):
2099+ client .ft ().create_index ((TextField ("t" ),))
2100+ client .ft ().client .hset ("1" , "t" , "hello" )
2101+ client .ft ().client .hset ("2" , "t" , "world" )
2102+
2103+ # check using Query
2104+ q = Query ("hello|world" ).no_content ()
2105+ if is_resp2_connection (client ):
2106+ res , det = client .ft ().profile (q )
2107+ det = det .info
2108+ assert det [0 ] == "Shards"
2109+ assert det [2 ] == "Coordinator"
2110+ assert det [1 ][0 ][9 ][7 ] == 2.0
2111+ assert det [1 ][0 ][9 ][1 ] == "UNION"
2112+ assert float (det [1 ][0 ][3 ]) < 0.5
2113+ assert len (res .docs ) == 2 # check also the search result
2114+
2115+ # check using AggregateRequest
2116+ req = (
2117+ aggregations .AggregateRequest ("*" )
2118+ .load ("t" )
2119+ .apply (prefix = "startswith(@t, 'hel')" )
2120+ )
2121+ res , det = client .ft ().profile (req )
2122+ det = det .info
2123+ assert det [0 ] == "Shards"
2124+ assert det [2 ] == "Coordinator"
2125+ assert det [1 ][0 ][9 ][5 ] == 2
2126+ assert det [1 ][0 ][9 ][1 ] == "WILDCARD"
2127+ assert len (res .rows ) == 2 # check also the search result
2128+ else :
2129+ res = client .ft ().profile (q )
2130+ res = res .info
2131+ assert res ["Profile" ]["Shards" ][0 ]["Iterators profile" ]["Counter" ] == 2.0
2132+ assert res ["Profile" ]["Shards" ][0 ]["Iterators profile" ]["Type" ] == "UNION"
2133+ assert res ["Profile" ]["Shards" ][0 ]["Parsing time" ] < 0.5
2134+ assert len (res ["Results" ]["results" ]) == 2 # check also the search result
2135+
2136+ # check using AggregateRequest
2137+ req = (
2138+ aggregations .AggregateRequest ("*" )
2139+ .load ("t" )
2140+ .apply (prefix = "startswith(@t, 'hel')" )
2141+ )
2142+ res = client .ft ().profile (req )
2143+ res = res .info
2144+ assert res ["Profile" ]["Shards" ][0 ]["Iterators profile" ]["Counter" ] == 2
2145+ assert res ["Profile" ]["Shards" ][0 ]["Iterators profile" ]["Type" ] == "WILDCARD"
2146+ assert isinstance (res ["Profile" ]["Shards" ][0 ]["Parsing time" ], float )
2147+ assert len (res ["Results" ]["results" ]) == 2 # check also the search result
2148+
2149+
2150+ @pytest .mark .redismod
2151+ @pytest .mark .onlynoncluster
2152+ @skip_if_redis_enterprise ()
2153+ @skip_if_server_version_gte ("6.3.0" )
2154+ def test_profile_with_no_warnings (client ):
2155+ client .ft ().create_index ((TextField ("t" ),))
2156+ client .ft ().client .hset ("1" , "t" , "hello" )
2157+ client .ft ().client .hset ("2" , "t" , "world" )
2158+
2159+ # check using Query
2160+ q = Query ("hello|world" ).no_content ()
2161+ res , det = client .ft ().profile (q )
2162+ det = det .info
2163+ print (det )
2164+ assert det [3 ][1 ][7 ] == 2.0
2165+ assert det [3 ][1 ][1 ] == "UNION"
2166+ assert float (det [1 ][1 ]) < 0.5
2167+ assert len (res .docs ) == 2 # check also the search result
2168+
2169+ # check using AggregateRequest
2170+ req = (
2171+ aggregations .AggregateRequest ("*" )
2172+ .load ("t" )
2173+ .apply (prefix = "startswith(@t, 'hel')" )
2174+ )
2175+ res , det = client .ft ().profile (req )
2176+ det = det .info
2177+ assert det [3 ][1 ][5 ] == 2
2178+ assert det [3 ][1 ][1 ] == "WILDCARD"
2179+ assert len (res .rows ) == 2 # check also the search result
2180+
2181+
2182+ @pytest .mark .redismod
2183+ @pytest .mark .onlynoncluster
2184+ @skip_if_server_version_gte ("7.9.0" )
2185+ @skip_if_server_version_lt ("6.3.0" )
20942186def test_profile_limited (client ):
20952187 client .ft ().create_index ((TextField ("t" ),))
20962188 client .ft ().client .hset ("1" , "t" , "hello" )
@@ -2124,6 +2216,8 @@ def test_profile_limited(client):
21242216
21252217@pytest .mark .redismod
21262218@skip_ifmodversion_lt ("2.4.3" , "search" )
2219+ @skip_if_server_version_gte ("7.9.0" )
2220+ @skip_if_server_version_lt ("6.3.0" )
21272221def test_profile_query_params (client ):
21282222 client .ft ().create_index (
21292223 (
0 commit comments