jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-952) Support lower and upper case functions in "order by" clause
Date Fri, 23 Oct 2009 09:18:59 GMT

    [ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769143#action_12769143
] 

Ard Schrijvers commented on JCR-952:
------------------------------------

Is there a usecase where people would like to sort case sensitive? If not, we could easily
change the code snippet below, to first lowercase the terms. But, I am not sure whether we
do want to have the option to sort case sensitive. 

In SharedFieldSortComparator :

return new ScoreDocComparator() {

           public final int compare(final ScoreDoc i, final ScoreDoc j) {
               int idx1 = readerIndex(i.doc);
               int idx2 = readerIndex(j.doc);

               String iTerm = indexes[idx1].getTerm(i.doc - starts[idx1]);
               String jTerm = indexes[idx2].getTerm(j.doc - starts[idx2]);

               if (iTerm == jTerm) {
                   return 0;
               } else if (iTerm == null) {
                   return -1;
               } else if (jTerm == null) {
                   return 1;
               } else {
                   return iTerm.compareTo(jTerm);
               }
           }

> Support lower and upper case functions in "order by" clause
> -----------------------------------------------------------
>
>                 Key: JCR-952
>                 URL: https://issues.apache.org/jira/browse/JCR-952
>             Project: Jackrabbit Content Repository
>          Issue Type: New Feature
>          Components: jackrabbit-core, query
>    Affects Versions: 1.3
>            Reporter: James Hang
>            Priority: Minor
>
> The query languages should support lower- and upper-case functions within the "order
by" clause.  This would provide case-insensitive ordering of query results.
> Example:  Find all "nt:base" nodes ordered by the "foo" property, but ignoring case
> In XPath:
> //element(*,nt:base) order by fn:lower-case(@foo)
> In SQL:
> SELECT * FROM nt:base ORDER BY lower(foo)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message