ilgrosso commented on a change in pull request #317:
URL: https://github.com/apache/syncope/pull/317#discussion_r813711581



##########
File path: 
core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java
##########
@@ -200,8 +200,11 @@ protected void fillAttrQuery(
                 case EQ:
                     
query.append("jsonb_path_exists(").append(schema.getKey()).append(", '$[*] ? ").
                             append("(@.").append(key);
-                    if (isStr) {
+                    if (POSTGRESQL_REGEX_CHARS.chars().mapToObj(c -> (char) c).
+                            anyMatch(c -> value.indexOf(c) > -1) || lower) {
                         query.append(" like_regex 
\"").append(escapeForLikeRegex(value).replace("'", "''")).append('"');
+                    } else if (isStr) {
+                        query.append(" == \"").append(value).append('"');

Review comment:
       Don't wrap string argument with quotes `"` but single quotes `'`, e.g.
   
   ```
   query.append(" == '").append(value).append("'");
   ```

##########
File path: 
core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java
##########
@@ -200,8 +200,11 @@ protected void fillAttrQuery(
                 case EQ:
                     
query.append("jsonb_path_exists(").append(schema.getKey()).append(", '$[*] ? ").
                             append("(@.").append(key);
-                    if (isStr) {
+                    if (POSTGRESQL_REGEX_CHARS.chars().mapToObj(c -> (char) c).

Review comment:
       Replace this condition with simpler
   
   ```
                       if (StringUtils.containsAny(value, 
POSTGRESQL_REGEX_CHARS) || lower) {
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to