如何在可搜索的XPath表达式中使用xdmp:estimate()?

bos*_*ari 2 xpath xquery marklogic

始终建议使用xdmp:estimate而不是fn:count.我知道如何在cts中使用它:搜索但不确定可搜索的XPath表达式.例如,我试图search:facets在执行后返回返回的计数search:search,就像这样 -
xdmp:estimate($search-result/search:facet/search:facet-value)但是
XDMP-UNSEARCHABLE-- Expression is unsearchable在使用fn:count工作时我得到错误.
救命!

Dav*_*nis 5

xdmp:estimate()返回匹配的片段数.您的示例是通过xPath表达式进行过滤.

你似乎在寻找什么可能是有效的使用 fn:count()

我们"通常"建议xdmp:estimate()在您的用例允许时使用.

指向搜索开发者指南的xdmp:estmatevs fn:count部分的链接:https: //docs.marklogic.com/guide/search-dev/count_estimate