From 350d474129598ecf8a99e005f10a849445c69a1d Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:38:11 +0600 Subject: [PATCH] Fix SORTABLE argument issue in FT.CREATE command (#3584) All I know these changes have been enough to pass all redis-om-spring tests in https://github.com/redis/redis-om-spring/pull/357 --- .../jedis/search/schemafields/TagField.java | 16 ++++++------- .../jedis/search/schemafields/TextField.java | 23 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/java/redis/clients/jedis/search/schemafields/TagField.java b/src/main/java/redis/clients/jedis/search/schemafields/TagField.java index 044f9d75f6..407c4dbddc 100644 --- a/src/main/java/redis/clients/jedis/search/schemafields/TagField.java +++ b/src/main/java/redis/clients/jedis/search/schemafields/TagField.java @@ -106,6 +106,14 @@ public void addParams(CommandArguments args) { args.add(SEPARATOR).add(separator); } + if (caseSensitive) { + args.add(CASESENSITIVE); + } + + if (withSuffixTrie) { + args.add(WITHSUFFIXTRIE); + } + if (sortableUNF) { args.add(SORTABLE).add(UNF); } else if (sortable) { @@ -115,13 +123,5 @@ public void addParams(CommandArguments args) { if (noIndex) { args.add(NOINDEX); } - - if (caseSensitive) { - args.add(CASESENSITIVE); - } - - if (withSuffixTrie) { - args.add(WITHSUFFIXTRIE); - } } } diff --git a/src/main/java/redis/clients/jedis/search/schemafields/TextField.java b/src/main/java/redis/clients/jedis/search/schemafields/TextField.java index f7967383c7..573cae90a3 100644 --- a/src/main/java/redis/clients/jedis/search/schemafields/TextField.java +++ b/src/main/java/redis/clients/jedis/search/schemafields/TextField.java @@ -107,29 +107,30 @@ public void addParams(CommandArguments args) { args.addParams(fieldName); args.add(TEXT); - if (sortableUNF) { - args.add(SORTABLE).add(UNF); - } else if (sortable) { - args.add(SORTABLE); + if (weight != null) { + args.add(WEIGHT).add(weight); } if (noStem) { args.add(NOSTEM); } - if (noIndex) { - args.add(NOINDEX); - } if (phoneticMatcher != null) { args.add(PHONETIC).add(phoneticMatcher); } - if (weight != null) { - args.add(WEIGHT).add(weight); - } - if (withSuffixTrie) { args.add(WITHSUFFIXTRIE); } + + if (sortableUNF) { + args.add(SORTABLE).add(UNF); + } else if (sortable) { + args.add(SORTABLE); + } + + if (noIndex) { + args.add(NOINDEX); + } } }