Skip to content

Commit

Permalink
Remove RediSearch DIALECT 5 support (#3886)
Browse files Browse the repository at this point in the history
This is partial revert of #3831.

Some changes are still available without dialect 5. For example:
* Avoid repeating for numeral equality
  • Loading branch information
sazzad16 authored Jul 11, 2024
1 parent b2bee0e commit b47b70f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -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")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -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")),
Expand Down

0 comments on commit b47b70f

Please sign in to comment.