Skip to main content

Administrating MarkLogic Server

Defining Attribute Range Indexes

To define a range index for an attribute of a particular element, follow these steps:

  1. Click the Databases icon on the left tree menu.

  2. Locate the database for which you want to create an index, either in the tree menu or in the Database Summary table.

  3. Click the name of the database for which you want to create an index.

  4. Under the selected database, click the Attribute Range Indexes icon in the tree menu for an attribute range index.

  5. Click the Add tab. The Add Attribute Range Indexes page appears:

    range_add_attribute_v10.gif
  6. Select the type of the XML attribute for which you want to build an attribute range index.

  7. 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 the Language Support in MarkLogic Server in the Search Developer’s Guide.

  8. Enter the namespace URI of the XML element that contains the attribute you want to index into the parent namespace URI field.

    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.

  9. Enter the element name in the parent localname field.

    The local name is the name of the XML element that contains the attribute to be indexed. If you have more than one element in the same namespace that contains the attribute you want to index, you can provide a comma-separated list of element names.

  10. Enter the namespace URI of the attribute that you want to index into the namespace URI field.

    Every XML attribute is associated with a namespace. For the description of the attribute to be precise, you must specify the namespace of the XML attribute. The asterisk (*) cannot be used to indicate namespace independence. Leaving the namespace URI field blank specifies the universal unnamed namespace.

  11. Enter the attribute name in the localname field.

    The local name is the name of the XML attribute to be indexed. If you have more than one attribute in the same namespace within the specified parent element(s) that you want to index, you can provide a comma-separated list of attribute names.

  12. Choose whether to index range value positions for this index. Setting the value to true will speed the performance of searches that use cts:near-query and cts:element-query with this index, but will use more disk space than leaving the positions off (range value positions false).

  13. In the invalid values field, choose whether to allow insertion of documents that contain attributes on which range index is configured, but the value of those attributes cannot be coerced to the index data type. You can choose either ignore or reject. By default, the server rejects insertion of such documents. However, if you choose ignore, 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.

  14. To add more indexes, click More Items and repeat Step 6 - Step 13 for each attribute index as needed.

  15. Scroll to the top or bottom and click OK.

The new attribute index is added to the database. These rules are applied to XML documents loaded into the specified database from this point on.

Note

If you have reindexing enabled for the database and you specify an element-attribute pair that exists in a document, reindexing will run in the background. When the reindexing is complete, the new index will become available to queries.