marklogic - 排序cts :search results by cts:score without using expicit loop

标签 marklogic marklogic-8

我想获得 cts:search 的结果数据根据 cts:score 排序.我正在使用以下代码 -

(
        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]

有什么办法可以从 cts:search 得到结果吗?以一种有序的方式本身?

当前代码的问题是,在大数据集的情况下,它会给出 XDMP-EXPNTREECACHEFULL 错误。增加 Expanded Tree Cache 的大小不是一种选择。所以我只需要在这部分做点什么。 请提出建议。

最佳答案

我找到了解决方案。我们可以使用 cts:score-order cts:search 中的选项

关于marklogic - 排序cts :search results by cts:score without using expicit loop,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36860985/

相关文章:

java.lang.ClassCastException : com. marklogic.xcc.jndi.ContentSourceBeanFactory 无法转换为 javax.naming.spi.InitialContextFactory]

admin - 在 MarkLogic 8.0-6.4 中找不到 in-mem-update.xqy

sparql - 有没有办法优化 SPARQL 查询?

node.js - 尝试对日期时间索引上的 MarkLogic 集合查询结果进行排序

marklogic - ML8 中的多语句变量

xquery - 如果我不在 Corb 中指定集合名称会发生​​什么

python-2.7 - MarkLogic/Python 查询仅搜索一个文件

marklogic - 在 Marklogic 中监控备份和恢复

批量插入marklogic的性能问题

marklogic - 任何人都可以解释如何在评分中计算 scoreSum