[forge-issues] [JBoss JIRA] (FORGE-1201) getSearchPredicates should use case insensitive search

Antonio Goncalves (JIRA) issues at jboss.org
Sat Feb 15 15:49:47 EST 2014


     [ https://issues.jboss.org/browse/FORGE-1201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Goncalves reassigned FORGE-1201:
----------------------------------------

    Assignee: Antonio Goncalves

    
> getSearchPredicates should use case insensitive search
> ------------------------------------------------------
>
>                 Key: FORGE-1201
>                 URL: https://issues.jboss.org/browse/FORGE-1201
>             Project: Forge
>          Issue Type: Feature Request
>    Affects Versions: 1.4.0.Final
>            Reporter: Antonio Goncalves
>            Assignee: Antonio Goncalves
>             Fix For: 2.x Future
>
>
> Hi,
> When you do JSF scaffolding, the generated code for research is as follow :
> {code}
>     private Predicate[] getSearchPredicates(Root<Talk> root) {
>         CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
>         List<Predicate> predicatesList = new ArrayList<>();
>         String title = this.example.getTitle();
>         if (title != null && !"".equals(title)) {
>             predicatesList.add(builder.like(root.<String>get("title"), '%' + title + '%'));
>         }
> {code}
> The problem with that is the search is case sensitive and searching for "java" or "Java" doesn't bring the same results. It would be more natural to have case insensitive search as follow : 
> {code}
>     private Predicate[] getSearchPredicates(Root<Talk> root) {
>         CriteriaBuilder builder = this.entityManager.getCriteriaBuilder();
>         List<Predicate> predicatesList = new ArrayList<>();
>         String title = this.example.getTitle();
>         if (title != null && !"".equals(title)) {
>             predicatesList.add(builder.like(builder.lower(root.<String>get("title")), "%" + title.toLowerCase() + "%"));
>         }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list