You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "James Hang (JIRA)" <ji...@apache.org> on 2007/05/29 20:36:16 UTC
[jira] Created: (JCR-952) Support lower and upper case functions in
"order by" clause
Support lower and upper case functions in "order by" clause
-----------------------------------------------------------
Key: JCR-952
URL: https://issues.apache.org/jira/browse/JCR-952
Project: Jackrabbit
Issue Type: New Feature
Components: 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915672#action_12915672 ]
Jukka Zitting commented on JCR-952:
-----------------------------------
> I have changed
> \openjpa\openjpa-kernel\src\main\jjtree\org\apache\openjpa\kernel\jpql\JPQL.jjt
Wrong issue?
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Alexander Karpov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915623#action_12915623 ]
Alexander Karpov commented on JCR-952:
--------------------------------------
I have changed
\openjpa\openjpa-kernel\src\main\jjtree\org\apache\openjpa\kernel\jpql\JPQL.jjt
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression()
}
to
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression()
upper()
}
and it works
Developers, who knows code well, any potential problems I can meet due to my fix?
Thanks.
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Ard Schrijvers (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769175#action_12769175 ]
Ard Schrijvers commented on JCR-952:
------------------------------------
Yes, agreed
> 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.
[jira] Issue Comment Edited: (JCR-952) Support lower and upper case
functions in "order by" clause
Posted by "Alexander Karpov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915623#action_12915623 ]
Alexander Karpov edited comment on JCR-952 at 9/28/10 2:47 AM:
---------------------------------------------------------------
I have changed
\openjpa\openjpa-kernel\src\main\jjtree\org\apache\openjpa\kernel\jpql\JPQL.jjt
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression()
}
to
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression() | upper()
}
and it works
Developers, who knows code well, any potential problems I can meet due to my fix?
Thanks.
was (Author: alexkarpov):
I have changed
\openjpa\openjpa-kernel\src\main\jjtree\org\apache\openjpa\kernel\jpql\JPQL.jjt
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression()
}
to
void orderby_extension() #ORDERBYEXTENSION : { }
{
aggregate_select_expression()
upper()
}
and it works
Developers, who knows code well, any potential problems I can meet due to my fix?
Thanks.
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769170#action_12769170 ]
Marcel Reutegger commented on JCR-952:
--------------------------------------
I think there are use cases for both. But we cannot just change the current behaviour and redefine it. That might break existing clients.
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Dennis Dam (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769128#action_12769128 ]
Dennis Dam commented on JCR-952:
--------------------------------
What I don't understand is, why is this issue open for 2,5 years already? And why is it a minor issue? As far as I'm concerned, this is a major issue. Can this be easily solved?
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Alexander Karpov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915680#action_12915680 ]
Alexander Karpov commented on JCR-952:
--------------------------------------
Yep, sorry :)
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Ard Schrijvers (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769133#action_12769133 ]
Marcel Reutegger commented on JCR-952:
--------------------------------------
> What I don't understand is, why is this issue open for 2,5 years already?
because nobody provided a patch
> And why is it a minor issue?
because this is a feature that is not part of the JCR specification.
> As far as I'm concerned, this is a major issue.
Feel free to contribute a patch.
> Can this be easily solved?
It is actually solved already. At least partially. Using JQOM or JCR_SQL2 you already have the ability to use a lower/upper case function in the order by clause. XPath and SQL (the query syntax defined in JCR 1.0) do not support them yet.
See classes LowerCaseSortComparator and UpperCaseSortComparator in jackrabbit-core. The parsers for XPath and SQL are in the module spi-commons.
> 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.
[jira] Commented: (JCR-952) Support lower and upper case functions
in "order by" clause
Posted by "Dennis Dam (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12769178#action_12769178 ]
Dennis Dam commented on JCR-952:
--------------------------------
What solution do you guys propose? Support for lower() and upper() functions in the order by clause, or perhaps the change proposed by Ard, but then as an optional feature?
> 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.