Hi Team,

Is there a way to sort alphabets before numbers. By default, letters have a
larger value than numbers which places them last in a sorted list, but I
wanted to list alphabets before number in an ascending sort.

I found no collation which can achieve this but came up with the following
work around which works as expected

let $items := ('absence','beautiful','life','360 Degree Feedback','1',
'10', '2', '11')
for $i in $items order by
if (fn:matches($i,'^[a-z]')) then fn:concat("1",$i) else fn:concat("2",$i)
ascending
return $i

Unfortunately the application uses search:search (with pagination) and
operates upon a huge data set. Therefore I'm facing two issues

1. Unable to apply this custom sort method to search:search
2. If the above workaround is used with cts:search then there is an impact
on performance

Is there a more optimized way to achieve this requirement?

Thanks,
Blessing.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to