Loading TOC...

MarkLogic 12 EA 1 Product Documentation
admin:range-assignment-policy

admin:range-assignment-policy(
   $partition-key as cts:reference,
   $lower-bound-included as xs:boolean
) as element(db:assignment-policy)

Summary

This function returns an element that represents the range assignment policy. Use the admin:database-set-assignment-policy function to set the assignment policy.

Parameters
partition-key This parameter specifies the cts reference that will be used as the partition key. It can be an element range index, an attribute range index, a field range index or a path range index. The range index can have any data type except for geospatial types.
lower-bound-included If this paramenter is fn:true(), ranges on all forests in the database have closed lower bounds and open upper bound; if it is fn:false(), ranges on all forests in the database have open lower bounds and closed upper bounds.

For example, if the partition range is 2011-01-02 (lower) to 2011-01-02 (upper) and lower-bound-include is set to fn:false(), documents with partition key value of 2011-01-02 will not be included in the partition, but documents with a partition key value of 2011-01-03 and 2011-01-02 will be included.

Example



xquery version "1.0-ml";

import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy";

(: An element range index is already configured for element "foo" on database "myDatabase" :)
let $config := admin:get-configuration()
let $dbid := admin:database-get-id($config, "myDatabase")
(: range assignment policy doesn't work with fast locking; use "strict" or no locking instead :)
let $config := admin:database-set-locking($config, $dbid, "strict")
let $ref := cts:element-reference(xs:QName("foo"))
let $range-policy := admin:range-assignment-policy($ref, fn:true())
let $config := admin:database-set-assignment-policy($config, $dbid, $range-policy)
return admin:save-configuration($config)

    

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