Defining Element Range Indexes
To define an element range index for an XML element or JSON property, follow these steps:
Click the Databases icon on the left tree menu.
Locate the database for which you want to create a range index, either in the tree menu or in the Database Summary table.
Click the name of the database for which you want to create a range index.
Click the Element Range Indexes icon in the tree menu, under the selected database.
Click the Add tab. The Add Range Indexes configuration page appears.
Select the type of the XML element or JSON property for which you want to build a range index.
If the index is of type
xs:string
, a collation box appears with a default collation. If you want the index to use a different collation than the default, enter the collation URI. You can click the Collation Builder button for a wizard that constructs the collation URI for you based on the language and other parameters you enter. For details about collations, see Language Support in MarkLogic Server in the Search Developer’s Guide.Enter the namespace URI of the XML element. Skip this step for a JSON property index.
Every XML element is associated with a namespace. For the description of the element to be precise, you must specify the namespace of the XML element. The asterisk (*) cannot be used to indicate namespace independence. Leaving the namespace URI field blank specifies the universal unnamed namespace.
Enter the element or JSON property name in the localname field.
The local name is the name of the XML element to be indexed. If you have more than one element of the same type in the same namespace that you want to index, you can provide a comma-separated list of element names.
Choose whether to index range value positions for this index. Setting range value positions to
true
will speed the performance of searches that usects:near-query
andcts:element-query
with this index, but will use more disk space than leaving the positions off (range value positionsfalse
).In the invalid values field, choose whether to allow insertion of documents that contain elements or JSON properties on which range index is configured, but the value of those elements cannot be coerced to the index data type. You can choose either
ignore
orreject
. By default, the server rejects insertion of such documents. However, if you chooseignore
, these documents can be inserted. This setting does not change the behavior of queries on invalid values after documents are inserted into the database. Performing an operation on an invalid value at query time can still result in an error.To add more indexes, click More Items and repeat Step 6 - Step 11 for each index as needed.
Scroll to the top or bottom and click OK.
The new element range index or element word lexicon is added to the database. These rules are applied to XML and JSON documents loaded into the specified database from this point on.
Note
If you have reindexing enabled for the database and you specify an element that exists in a document, reindexing will run in the background. When the reindexing is complete, the new index will become available to queries.