diff --git a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java index 48f89adfbe..b32a7d1f7e 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchUtil.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchUtil.java @@ -57,7 +57,7 @@ public static byte[] ToByteArray(float[] input) { return bytes; } - public static final Set TAG_ESCAPE_CHARS = new HashSet<>(Arrays.asList(// + private static final Set ESCAPE_CHARS = new HashSet<>(Arrays.asList(// ',', '.', '<', '>', '{', '}', '[', // ']', '"', '\'', ':', ';', '!', '@', // '#', '$', '%', '^', '&', '*', '(', // @@ -77,7 +77,7 @@ public static String escape(String text, boolean querying) { StringBuilder sb = new StringBuilder(); for (char ch : chars) { - if (TAG_ESCAPE_CHARS.contains(ch) + if (ESCAPE_CHARS.contains(ch) || (querying && ch == ' ')) { sb.append("\\"); }