Search code examples
searchmarklogiclexicon

Marklogic lexicons: understanding cts:element-values


I am trying to understand the usage of

cts:element-values($element-names as xs:QName*,[$start as xs:anyAtomicType?])

I was under the impression that the above function returns values from the specified element value lexicon, starting with $start. On Querying:

cts:element-values(xs:QName("ts:title"), "He")

I was expecting results starting with "He" only, but I have also got results such as:

(as I scroll down) I Feel Fine

I Get Around

I would like to know what exactly does $start specify ?


Solution

  • Think of $start not as a starting prefix but as a starting location in the list. You're getting all the values from that point onward.

    To limit by prefix you want to use cts:element-value-match which accepts a $pattern. http://docs.marklogic.com/cts:element-value-match