cts:uris score-random 选项不返回随机 URI

cts:uris score-random option does not returned random URIs

cts:uris 函数中,我将 "score-random" 添加到查询的选项中,但结果 returns 相同。

这是我的示例查询

cts:uris("",("score-random"), cts:collection-query('my-collection')) [1 to 10]

与 cts:search 相比 returns 随机结果

cts:search(collection("my-collection"), cts:and-query(()), ("score-random"))[1 to 10] ! document-uri(.)

试试这个:

cts:uris("",("score-random","sample=10"), cts:collection-query('my-collection'))

基本上使用"sample=10"而不是[1 to 10]

cts:uris() 函数始终returns 其 URI 按字母顺序、升序或降序排序。在这里,我要求随机抽取 10 个样本返回,然后按字母顺序返回。

想要返回的 10 个随机排列吗?

for $uri in cts:uris("",("score-random","sample=10"), cts:collection-query('my-collection'))
order by xdmp:random()
return $uri

(使用我的回答中的技巧)