Search code examples
marklogic

Looking for effective way to retrieve cts:element-values() count


I need to test the number of entry of a specific lexicon (range index). I can do it using fn:count(cts:element-values()), but this will end up running too slowly with a large lexicon. Is there a better way to compute the total number of values ?

Note that I don't wan't the number of fragment as returned by cts:count-aggregate, but the number of values.

Thanks for help


Solution

  • No. There is no better query. Maybe run once and cache the results for reuse.

    You don’t say how slow it is. It shouldn’t take more than a few seconds usually if you’ve got the right cluster size.