Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-4055

Have AuthorizableQueryManager Support Named search with ignorecase

    XMLWordPrintableJSON

Details

    Description

      Usecase :

      We need to make search on Name and AuthorizableId while searching for users. Hence we used the 'named'[0] token while creating the json. But we realized that 'named' token doesn't support the ignore case feature due to which our search is failing. Can you please include an option to enable/disable the ignore case functionality.

      I have found a similar jira[1] reported earlier for the sort option.

      Sample Query :

      select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and contains([rep:principalName], 'rohan.raj@sandisk.com*')
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and contains([cq:first-name], 'rohan.raj@sandisk.com*')
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and contains([cq:last-name], 'rohan.raj@sandisk.com*')
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and contains([profile/givenName], 'rohan.raj@sandisk.com*')
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and contains([profile/familyName], 'rohan.raj@sandisk.com*')
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and [rep:authorizableId] like 'rohan.raj@sandisk.com'
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and [rep:principalName] like 'rohan.raj@sandisk.com'
      union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where isdescendantnode(a, '/home') and name(a) like 'rohan.raj@sandisk.com'
      order by lower([rep:principalName]

      The name(a) like 'rohan.raj@sandisk.com' doesn't honor the ignorecase.

      Sample Calling :

      public Iterator<Authorizable> execute(final String query) throws RepositoryException, IOException {
      try {
      return userManager.findAuthorizables(new Query(){
      public <T>void build( QueryBuilder<T> builder){
      try

      { builder.setLimit(0,MAX_RESULT_COUNT); new QueryTranslator<T>(builder).translate(query); }

      catch ( IOException e)

      { throw new IllegalArgumentException(e); }

      }
      }
      );
      }
      catch ( IllegalArgumentException e) {
      Throwable cause=e.getCause();
      if (cause instanceof IOException)

      { throw (IOException)cause; }

      else

      { throw e; }

      }
      }

      [0] https://docs.adobe.com/content/docs/en/aem/6-0/develop/ref/javadoc/org/apache/jackrabbit/api/security/user/QueryBuilder.html#nameMatches(java.lang.String)

      [1] https://issues.apache.org/jira/browse/JCR-3845

      Attachments

        Activity

          People

            Unassigned Unassigned
            krachit13@gmail.com Rachit Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: