[MarkLogic Dev General] xdmp:estimate() and fn:distinct-values()

Danny Sinang d.sinang at gmail.com
Fri Aug 3 19:38:05 PDT 2012


The query below runs quite fast (i.e. below 1 second).

let $totalCount := xdmp:estimate(/user[reg/productId=$myBooks]/userId)
let $numUnexpired := xdmp:estimate(/user[reg[productId=$myBooks and
(endDate = 0 or endDate >= $current-epoch-time)]]/userId)
return ($totalCount, $numUnexpired, xdmp:elapsed-time())

Problem is, what I really need is to get the number of distinct values of

Doing xdmp:estimate(fn:distinct-values()) results in in XDMP:UNSEARCHABLE

Using fn:count() instead of xdmp:estimate() works, but takes so long (i.e.
30 seconds).

Is there a workaround for this ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120803/224d1471/attachment.html 

More information about the General mailing list