Loading TOC...

MarkLogic Server 11.0 Product Documentation
xdmp:document-partition-assign

xdmp:document-partition-assign(
   $root as node(),
   [$partition-queries as map:map]
) as xs:unsignedInt?

Summary

Assign a document to a partition number, using the partition queries in the database or in the second argument. The return value is the partition number where the document should be inserted.

Parameters
root The document to assign.
partition-queries A map of partition-number to cts query.

Example

xdmp:document-partition-assign("<top><a>hello world</a></top>")
=> 2

Example

xquery version "1.0-ml";

let $map := map:map()
let $put := map:put($map,"1",
  cts:element-range-query(
xs:QName("create-time"),
">=",
xs:dateTime("2014-01-01T00:00:00")))
let $put := map:put($map,"2",
  cts:element-range-query(
xs:QName("create-time"),
">=",
xs:dateTime("2013-01-01T00:00:00")))

return
xdmp:document-partition-assign(
<root>
<name>test1</name>
<create-time>2013-07-05T00:00:00</create-time>
</root>,
$map
)
=>2

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