Skip to content

Commit

Permalink
Use protocol variable in SearchWithParamsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Aug 7, 2023
1 parent ddc968e commit 117efef
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import redis.clients.jedis.search.schemafields.*;
import redis.clients.jedis.search.schemafields.VectorField.VectorAlgorithm;
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
import redis.clients.jedis.util.RedisProtocolUtil;

public class SearchWithParamsTest extends RedisModuleCommandsTestBase {

Expand Down Expand Up @@ -1037,7 +1036,7 @@ public void maxPrefixExpansionSearchProfile() {
Map.Entry<SearchResult, Map<String, Object>> reply = client.ftProfileSearch(index,
FTProfileParams.profileParams(), "foo*", FTSearchParams.searchParams().limit(0, 0));
// Warning=Max prefix expansion reached
if (RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3) {
if (protocol != RedisProtocol.RESP3) {
assertEquals("Max prefix expansion reached",
((Map) reply.getValue().get("Iterators profile")).get("Warning"));
} else {
Expand All @@ -1058,7 +1057,7 @@ public void noContentSearchProfile() {
Map.Entry<SearchResult, Map<String, Object>> profile = client.ftProfileSearch(index,
FTProfileParams.profileParams(), "foo -@t:baz", FTSearchParams.searchParams().noContent());

Map<String, Object> depth0 = RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3
Map<String, Object> depth0 = protocol != RedisProtocol.RESP3
? (Map<String, Object>) profile.getValue().get("Iterators profile")
: ((List<Map<String, Object>>) profile.getValue().get("Iterators profile")).get(0);

Expand All @@ -1067,7 +1066,7 @@ public void noContentSearchProfile() {
assertEquals("TEXT", depth0_children.get(0).get("Type"));
Map<String, Object> depth1 = depth0_children.get(1);
assertEquals("NOT", depth1.get("Type"));
if (RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3) {
if (protocol != RedisProtocol.RESP3) {
List<Map<String, Object>> depth1_children = (List<Map<String, Object>>) depth1.get("Child iterators");
assertEquals(1, depth1_children.size());
assertEquals("EMPTY", depth1_children.get(0).get("Type"));
Expand All @@ -1086,7 +1085,7 @@ public void deepReplySearchProfile() {
= client.ftProfileSearch(index, FTProfileParams.profileParams(),
"hello(hello(hello(hello(hello(hello)))))", FTSearchParams.searchParams().noContent());

Map<String, Object> depth0 = RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3
Map<String, Object> depth0 = protocol != RedisProtocol.RESP3
? (Map<String, Object>) profile.getValue().get("Iterators profile")
: ((List<Map<String, Object>>) profile.getValue().get("Iterators profile")).get(0);

Expand Down Expand Up @@ -1125,7 +1124,7 @@ public void limitedSearchProfile() {
Map.Entry<SearchResult, Map<String, Object>> profile = client.ftProfileSearch(index,
FTProfileParams.profileParams().limited(), "%hell% hel*", FTSearchParams.searchParams().noContent());

Map<String, Object> depth0 = RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3
Map<String, Object> depth0 = protocol != RedisProtocol.RESP3
? (Map<String, Object>) profile.getValue().get("Iterators profile")
: ((List<Map<String, Object>>) profile.getValue().get("Iterators profile")).get(0);

Expand All @@ -1137,7 +1136,7 @@ public void limitedSearchProfile() {
for (Map<String, Object> depth1 : depth0_children) {
assertEquals("UNION", depth1.get("Type"));
assertNotNull(depth1.get("Query type"));
if (RedisProtocolUtil.getRedisProtocol() != RedisProtocol.RESP3) {
if (protocol != RedisProtocol.RESP3) {
List depth1_children = (List) depth1.get("Child iterators");
assertEquals(1, depth1_children.size());
assertSame(String.class, depth1_children.get(0).getClass());
Expand Down

0 comments on commit 117efef

Please sign in to comment.