
tieredstorage:partition-set-query( $schema-database-id as xs:unsignedLong, $partition-number as xs:unsignedInt, $query as cts:query ) as empty-sequence()
This function sets the query for a partition specified by the partition number.
xquery version "1.0-ml";
import module namespace ts="http://marklogic.com/xdmp/tieredstorage"
at "/MarkLogic/tieredstorage.xqy";
ts:partition-set-query(
xdmp:database("Schemas"),
1,
cts:element-range-query(
QName("","create-date"),">",
xs:dateTime("2014-01-01T00:00:00")))
(: Sets the query for parition 1 in the Schemas database. :)
xquery version "1.0-ml";
import module namespace ts="http://marklogic.com/xdmp/tieredstorage"
at "/MarkLogic/tieredstorage.xqy";
ts:partition-set-query(
xdmp:schema-database(xdmp:database("Schemas")),
1,
cts:element-range-query(
xs:QName("LastModified"),
">=",
xs:yearMonthDuration("P1Y")))
(: Sets the query for parition 1 in the Schemas database so that
the documents with a LastModified date within last year will
go to partition 1. Other documents will go to partition 2. :)