From b47b70f58f97495bac761be593be6402f462ab26 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:01:36 +0600 Subject: [PATCH] Remove RediSearch DIALECT 5 support (#3886) This is partial revert of #3831. Some changes are still available without dialect 5. For example: * Avoid repeating for numeral equality --- .../redis/clients/jedis/modules/search/SearchTest.java | 6 ++---- .../jedis/modules/search/SearchWithParamsTest.java | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/test/java/redis/clients/jedis/modules/search/SearchTest.java b/src/test/java/redis/clients/jedis/modules/search/SearchTest.java index 6fc9bcadf7..0776eabcd4 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SearchTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SearchTest.java @@ -413,7 +413,7 @@ public void testQueryParams() { Query query = new Query("@numval:[$min $max]").addParam("min", 1).addParam("max", 2).dialect(2); assertEquals(2, client.ftSearch(index, query).getTotalResults()); - query = new Query("@numval:[$eq]").addParam("eq", 2).dialect(5); + query = new Query("@numval:[$eq]").addParam("eq", 2).dialect(4); assertEquals(1, client.ftSearch(index, query).getTotalResults()); } @@ -540,7 +540,7 @@ public void testJsonWithAlias() { assertEquals(1, res.getTotalResults()); assertEquals("king:1", res.getDocuments().get(0).getId()); - res = client.ftSearch(index, new Query("@num:[42]").dialect(5)); + res = client.ftSearch(index, new Query("@num:[42]").dialect(4)); assertEquals(1, res.getTotalResults()); assertEquals("king:1", res.getDocuments().get(0).getId()); } @@ -784,7 +784,6 @@ public void getTagField() { assertEquals(1, client.ftSearch(index, new Query("@category:{yellow}")).getTotalResults()); assertEquals(0, client.ftSearch(index, new Query("@category:{purple}")).getTotalResults()); assertEquals(1, client.ftSearch(index, new Query("@category:{orange\\;purple}")).getTotalResults()); - assertEquals(1, client.ftSearch(index, new Query("@category:{orange;purple}").dialect(5)).getTotalResults()); assertEquals(4, client.ftSearch(index, new Query("hello")).getTotalResults()); assertEquals(new HashSet<>(Arrays.asList("red", "blue", "green", "yellow", "orange;purple")), @@ -826,7 +825,6 @@ public void testGetTagFieldWithNonDefaultSeparator() { assertEquals(1, client.ftSearch(index, new Query("hello @category:{yellow}")).getTotalResults()); assertEquals(0, client.ftSearch(index, new Query("@category:{purple}")).getTotalResults()); assertEquals(1, client.ftSearch(index, new Query("@category:{orange\\,purple}")).getTotalResults()); - assertEquals(1, client.ftSearch(index, new Query("@category:{orange,purple}").dialect(5)).getTotalResults()); assertEquals(4, client.ftSearch(index, new Query("hello")).getTotalResults()); assertEquals(new HashSet<>(Arrays.asList("red", "blue", "green", "yellow", "orange,purple")), diff --git a/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java b/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java index 3cd6bca1c6..f4c584d507 100644 --- a/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/SearchWithParamsTest.java @@ -610,7 +610,7 @@ public void testQueryParams() { .dialect(2)).getTotalResults()); assertEquals(1, client.ftSearch(index, "@numval:[$eq]", - FTSearchParams.searchParams().addParam("eq", 2).dialect(5)).getTotalResults()); + FTSearchParams.searchParams().addParam("eq", 2).dialect(4)).getTotalResults()); } @Test @@ -673,7 +673,7 @@ public void testJsonWithAlias() { assertEquals(1, res.getTotalResults()); assertEquals("king:1", res.getDocuments().get(0).getId()); - res = client.ftSearch(index, "@num:[42]", FTSearchParams.searchParams().dialect(5)); + res = client.ftSearch(index, "@num:[42]", FTSearchParams.searchParams().dialect(4)); assertEquals(1, res.getTotalResults()); assertEquals("king:1", res.getDocuments().get(0).getId()); } @@ -879,8 +879,6 @@ public void getTagField() { assertEquals(1, client.ftSearch(index, "@category:{yellow}").getTotalResults()); assertEquals(0, client.ftSearch(index, "@category:{purple}").getTotalResults()); assertEquals(1, client.ftSearch(index, "@category:{orange\\;purple}").getTotalResults()); - assertEquals(1, client.ftSearch(index, "@category:{orange;purple}", - FTSearchParams.searchParams().dialect(5)).getTotalResults()); assertEquals(4, client.ftSearch(index, "hello").getTotalResults()); assertEquals(new HashSet<>(Arrays.asList("red", "blue", "green", "yellow", "orange;purple")), @@ -920,8 +918,6 @@ public void testGetTagFieldWithNonDefaultSeparator() { assertEquals(1, client.ftSearch(index, "hello @category:{yellow}").getTotalResults()); assertEquals(0, client.ftSearch(index, "@category:{purple}").getTotalResults()); assertEquals(1, client.ftSearch(index, "@category:{orange\\,purple}").getTotalResults()); - assertEquals(1, client.ftSearch(index, "@category:{orange,purple}", - FTSearchParams.searchParams().dialect(5)).getTotalResults()); assertEquals(4, client.ftSearch(index, "hello").getTotalResults()); assertEquals(new HashSet<>(Arrays.asList("red", "blue", "green", "yellow", "orange,purple")),