Hello,
I have a list of pages that I am querying using xpath and ordering by jcr:title.
How do I ignore accented characters?
For example if I have a page with jcr:title = Études, it will show up at the bottom of the list instead of near the top.
Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
In SQL2 query (also known as JCR-SQL2), you can use the COLLATE
function to ignore accented characters when ordering by jcr:title. The COLLATE
function allows you to specify a collation to control the sorting behavior.
Here's an example of an SQL2 query that ignores accented characters when ordering by jcr:title:
SELECT * FROM [nt:base] AS node
WHERE ISDESCENDANTNODE('/path/to/your/pages')
ORDER BY COLLATE(node.[jcr:title], 'ICU_Locale=fr,strength=primary')
In this example, ICU_Locale=fr
specifies that the collation should follow French language rules for sorting, and strength=primary
specifies that only primary differences (such as accented characters) should be considered significant for ordering.
By using the COLLATE
function with the appropriate collation settings, you can ensure that accented characters are ignored when ordering your pages by jcr:title. This will result in a more accurate sorting order that takes into account language-specific rules.
In SQL2 query (also known as JCR-SQL2), you can use the COLLATE
function to ignore accented characters when ordering by jcr:title. The COLLATE
function allows you to specify a collation to control the sorting behavior.
Here's an example of an SQL2 query that ignores accented characters when ordering by jcr:title:
SELECT * FROM [nt:base] AS node
WHERE ISDESCENDANTNODE('/path/to/your/pages')
ORDER BY COLLATE(node.[jcr:title], 'ICU_Locale=fr,strength=primary')
In this example, ICU_Locale=fr
specifies that the collation should follow French language rules for sorting, and strength=primary
specifies that only primary differences (such as accented characters) should be considered significant for ordering.
By using the COLLATE
function with the appropriate collation settings, you can ensure that accented characters are ignored when ordering your pages by jcr:title. This will result in a more accurate sorting order that takes into account language-specific rules.