[MarkLogic Dev General] Field lexicon and frequency

Geert Josten geert.josten at dayon.nl
Thu Mar 8 06:31:53 PST 2012

Hi Stéphane,

It would be great to be able to use cts:frequency on words from field or
word lexicons too. (Could anyone comment on why this is not possible?)

But since that doesn't work (simply returns zero), you have either the
option to:
-  tokenize the element values and store each token as a separate element
value, and use element range index to be able to use cts:frequency
- do a cts:search for each word, and approximate the frequency with a
doc/fragment count using xdmp:estimate

Kind regards,

> -----Oorspronkelijk bericht-----
> Van: general-bounces at developer.marklogic.com [mailto:general-
> bounces at developer.marklogic.com] Namens Stephane Toussaint
> Verzonden: donderdag 8 maart 2012 11:52
> Aan: General MarkLogic Developer Discussion
> Onderwerp: [MarkLogic Dev General] Field lexicon and frequency
> Hi,
> I'm looking for a way to retrieve not only words from a lexicon (field
> actually) but the number of occurrence as well.
> I know that this is something easy to do with cts:frequency but only for
> or attribute lexicon, not field.
> My use case is to create a field that store element that participate to
> wordcloud. And then return words and there occurrence to build a
> That is for the big picture, maybe there's something better to do this.
> Thanks
> Stéphane
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general

More information about the General mailing list