Reputation: 2630
I am using MarkLogic 8.0-6.3
I have to sort strings where lowercase letters should be sorted at first.
for example:
('a', 'A', 'b', 'B') should be sorted like ('a', 'b', 'A', 'B')
Default code-point collation will sort lowercase letters at last.
Update:
Output with collation http://marklogic.com/collation//CL
Upvotes: 1
Views: 90
Reputation: 66851
I don't think that you can achieve what you want with collations.
You could use the SI
<strength>
attribute: http://marklogic.com/collation//SI
for $i in ("a", "A", "b", "B")
order by $i descending collation "http://marklogic.com/collation//SI"
return $i
But that would return ('b', 'a', 'B', 'A')
Instead of collation, could test whether the value is equal to it's fn:lower-case()
value, and sort by that boolean value:
for $i in ("a", "A", "b", "B")
order by $i eq lower-case($i) descending
return $i
Upvotes: 1
Reputation: 20414
You can use http://marklogic.com/collation//CL
. Documentation on this can be found in the search-dev guide, in the section Attribute Portion of the Collation URI. It can also be useful to look at a random string index in the Admin UI. There is a Collation Builder utility (small button behind the collation setting), which can help you click together the collation you need.
HTH!
Upvotes: 0