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

George Gastaldi (JIRA) jira-events at lists.jboss.org
Sun Oct 13 21:02:35 EDT 2013


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

George Gastaldi updated FORGE-1201:
-----------------------------------

    Fix Version/s: 2.x Future

    
> 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
>             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