Skip to main content

Administrating MarkLogic Server

Using Range Indexes for Value Lexicons

In addition to speeding up sorting and comparison queries, MarkLogic Server uses range indexes to resolve XML element, XML attribute, JSON property, and field value lexicon queries. These are queries that use the following search APIs:

  • cts:values

  • cts:value-match

  • cts:element-attribute-values

  • cts:element-attribute-value-match

  • cts:element-values

  • cts:element-value-match

  • cts:field-values

  • cts:field-value-match

The cts:values and cts:value-match functions work on any kind of range index and are equivalent to the corresponding index-specific function when called with a reference to the same type of index. For example, the following two function calls are equivalent:

cts:values(cts:element-reference(xs:QName("some-element")))
cts:element-values(xs:QName("some-element")

In order to use any of these APIs, you must create range indexes on the element(s), attribute(s), JSON property(s), or field(s) specified in the query. The type of the range index must match the type specified in the lexicon API.

For details about lexicons, see the Browsing With Lexicons in the Search Developer’s Guide. For more details on the lexicon APIs, see the MarkLogic XQuery and XSLT Function Reference.