[ 
https://issues.apache.org/jira/browse/JCR-4055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rachit Kumar updated JCR-4055:
------------------------------
    Description: 
Usecase :

We need to make search on Named[0] and AuthorizableId while searching for 
users. Hence we used the 'named' token while creating the json. But we realized 
that 'named' token doesn't support the ignorecase feature due to which our 
search is failing. Can you please include an option to enable/disable the 
ignorecase 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], 
'[email protected]*')
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and contains([cq:first-name], 
'[email protected]*')
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and contains([cq:last-name], 
'[email protected]*')
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and contains([profile/givenName], 
'[email protected]*')
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and contains([profile/familyName], 
'[email protected]*')
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and [rep:authorizableId] like 
'[email protected]'
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and [rep:principalName] like 
'[email protected]'
union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
isdescendantnode(a, '/home') and name(a) like '[email protected]'
order by lower([rep:principalName]

The name(a) like '[email protected]' 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



  was:
Usecase :

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

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

[0] 
https://jackrabbit.apache.org/api/2.4/org/apache/jackrabbit/commons/jackrabbit/user/AuthorizableQueryManager.html
[1] https://issues.apache.org/jira/browse/JCR-3845

Sample Query :

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

The name(a) like '[email protected]' 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;
    }
  }
}


>  Have AuthorizableQueryManager Support Named search with ignorecase
> -------------------------------------------------------------------
>
>                 Key: JCR-4055
>                 URL: https://issues.apache.org/jira/browse/JCR-4055
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>          Components: jackrabbit-jcr-commons
>    Affects Versions: 2.8
>            Reporter: Rachit Kumar
>            Assignee: angela
>             Fix For: 2.9.1
>
>
> Usecase :
> We need to make search on Named[0] and AuthorizableId while searching for 
> users. Hence we used the 'named' token while creating the json. But we 
> realized that 'named' token doesn't support the ignorecase feature due to 
> which our search is failing. Can you please include an option to 
> enable/disable the ignorecase 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], 
> '[email protected]*')
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and contains([cq:first-name], 
> '[email protected]*')
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and contains([cq:last-name], 
> '[email protected]*')
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and contains([profile/givenName], 
> '[email protected]*')
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and contains([profile/familyName], 
> '[email protected]*')
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and [rep:authorizableId] like 
> '[email protected]'
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and [rep:principalName] like 
> '[email protected]'
> union select [jcr:path], [jcr:score], * from [rep:Authorizable] as a where 
> isdescendantnode(a, '/home') and name(a) like '[email protected]'
> order by lower([rep:principalName]
> The name(a) like '[email protected]' 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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to