I want to get results of cts:search data sorted on the basis of cts:score. I am using following code -
(
if ($direction = "descending")
then
for $result in cts:search (...)
order by cts:score($result) descending
return $result/element()
else
for $result in cts:search (...)
order by cts:score($result) ascending
return $result/element()
)[$first-result to $last-result]
Is there any way out of getting results from cts:search in a sorted manner itself?
The problem with the current code is that in the case of large data set it gives XDMP-EXPNTREECACHEFULL error. Increasing the size of Expanded Tree Cache is not an option. So I need to do something in this part only. Suggestions please.
I got the solution to this. We can use cts:score-order option with in the cts:search