Learn R Programming

rfml (version 0.1.0)

ml.add.index: Creates or updates a Range element index.

Description

The function creates or updates a range element index on the underlying element/property of a ml.data.frame field. The user that is used for the login needs the manage-admin role, or the following privilege:
  • http://marklogic.com/xdmp/privileges/manage-admin

Usage

ml.add.index(x, scalarType = "string", collation = "http://marklogic.com/collation/", namespaceUri = "", database = "Documents", host = "", port = "8002", adminuser = "", password = "", conn = NA)

Arguments

x
a ml.data.frame field that the index will be created on
scalarType
An atomic type specification. "string" is default
collation
For scalarType = string, you can use a different collation than the default. Default is "http://marklogic.com/collation/"
namespaceUri
The namespace URI of the XML element, if JSON ignore. Default is empty.
database
The name of the database to create the index in. "Documents" is default.
host
The hostname or ipadress of the MarkLogic Manage server. Default is the same as used for conn
port
The port number of the MarkLogic Manage server. 8002 is used default
adminuser
The username of a user that have rights to create index. Default is the same as used for conn
password
The password. Default is the same as used for conn.
conn
A ml.conn-class with a connection to a MarkLoic server. Optional.

Value

The function will raise a error if something goes wrong.

Details

The function only creates and updates range index on a XML element or JSON property based on the ml.data.frame field. Information about the field can be shown by mlDataFrame$itemField, where mlDataFrame is a ml.data.frame object and itemField is the name of the field. Indexes created with this function will always have range-value-positions equal true.