You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Cédric Damioli <cd...@apache.org> on 2012/10/09 23:00:02 UTC

Collating ordered query results

Hi team,

As a French native, I often have to manipulate text containing accents.

So that when I execute some Xpath query like "//text order by @title", I 
may get a text titled "Aéroport" ordered after a text titled "Avion", 
which is not correct.

My first idea was to create a special function allowing to write 
something like "//text order by fn:normalize(@title)" or something like 
that. This function would consider "Aéroport" as "Aeroport", leading to 
the expected result.
Then I discover than, at least for Xpath, the grammar (inherited from 
XPath 2.0) permit a more standard "//text order by @title collation 
'XXX'" which may also be implemented in Jackrabbit with a little more 
work but won't be natural in SQL

So my first question is : does someone already thought about collations 
? Possibly with an already working solution ?
Second question : which of my two solutions fit the best in Jackrabbit 
(or possibly a third one) ?
And finally third question : if I implement such a collation algorithm, 
would someone be interested to have it in the Jackrabbit core ?

Best regards,

-- 
Cédric Damioli
Ametys CMS
http://www.ametys.org
http://www.anyware-services.com


Re: Collating ordered query results

Posted by Cédric Damioli <cd...@apache.org>.
Hi guys,

Following on this, I've submitted a patch here : 
https://issues.apache.org/jira/browse/JCR-3443
I propose a new XPath function fn:normalize which works perfectly in my 
case.

I'm now awaiting your comments to know what to do with it :)

Best regards,
Cédric

Le 09/10/2012 23:00, Cédric Damioli a écrit :
> Hi team,
>
> As a French native, I often have to manipulate text containing accents.
>
> So that when I execute some Xpath query like "//text order by @title", 
> I may get a text titled "Aéroport" ordered after a text titled 
> "Avion", which is not correct.
>
> My first idea was to create a special function allowing to write 
> something like "//text order by fn:normalize(@title)" or something 
> like that. This function would consider "Aéroport" as "Aeroport", 
> leading to the expected result.
> Then I discover than, at least for Xpath, the grammar (inherited from 
> XPath 2.0) permit a more standard "//text order by @title collation 
> 'XXX'" which may also be implemented in Jackrabbit with a little more 
> work but won't be natural in SQL
>
> So my first question is : does someone already thought about 
> collations ? Possibly with an already working solution ?
> Second question : which of my two solutions fit the best in Jackrabbit 
> (or possibly a third one) ?
> And finally third question : if I implement such a collation 
> algorithm, would someone be interested to have it in the Jackrabbit 
> core ?
>
> Best regards,
>
>
> -- 
> Cédric Damioli
> Ametys CMS
> http://www.ametys.org
> http://www.anyware-services.com