How do I alphabetically order a list of pages and ignore accents? | Community
Skip to main content
Level 2
October 16, 2015
Solved

How do I alphabetically order a list of pages and ignore accents?

  • October 16, 2015
  • 1 reply
  • 694 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

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.

1 reply

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 21, 2023

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.