for $i in cts:search(fn:collection()/article, $query)
let $snippet :=
search:snippet( $i,.....)
order by if ($randomize) then ()
else if($sort-by = "ascending") then
xs:date($i/date_posted), cts:score($i)
else xs:date($i/date_posted) descending, cts:score($i) descending
return
element{"article"}
{ .....
.....
.....
}
Problem:
In above x-query statement, the order by clause has a condition that if($randomize) then ()
else the output provided will be in descending manner.
I have a requirement that according the sort-type provided by user I want to pull out the results in ascending or descending manner.
但对于上述书面代码, 我的x询问声明将无法验证 。
Thanks in Advance,
~Prashant