Loading TOC...

admin.databaseRangePathIndex

admin.databaseRangePathIndex(
   $database-id as (Number|String),
   $scalar-type as String,
   $pathexpr as String,
   $collation as String?,
   $range-value-positions as Boolean,
   $invalid-values as String
) as element(db.rangePathIndex)

Summary

This function constructs a path range index specification.

Parameters
$database-id The ID of the database (for example, xdmp:database("myDatabase")).
$scalar-type A valid type for the range index. Must be one of: int, unsignedInt, long, unsignedLong, float, double, decimal, dateTime, time, date, gYearMonth, gYear, gMonth, gDay, yearMonthDuration, dayTimeDuration, string, anyURI, or point.
$pathexpr A valid XPath expression.
$collation The collation URI (for example, http://marklogic.com/collation/). The collation is only needed for string and anyURI indexes; for other indexes, specify the empty string ("") for this parameter.
$range-value-positions A boolean specifying whether to maintain value positions in this index (used with co-occurrences).
$invalid-values An option to handle values that do not meet the range index type. Must be one of: reject,ignore.

Example

  
  const admin = require('/MarkLogic/admin.xqy');
  admin.databaseRangePathIndex(
  xdmp.database('Documents'),
  "string",
  "/a/b/c",

  "http://marklogic.com/collation/",
  fn.false(),
  "ignore")
  =>
  <rangePathIndex xmlns="http://marklogic.com/xdmp/database">
    <scalarType>string</scalarType>
    <pathExpression>/a/b/c</pathExpression>
    <collation>http://marklogic.com/collation/</collation>
    <rangeValuePositions>false</rangeValuePositions>
    <invalidValues>ignore</invalidValues>
  </rangePathIndex>
    

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.