Loading TOC...

MarkLogic 9 Product Documentation
tieredstorage:partition-set-query

tieredstorage:partition-set-query(
   $schema-database-id as xs:unsignedLong,
   $partition-number as xs:unsignedInt,
   $query as cts:query
) as empty-sequence()

Summary

This function sets the query for a partition specified by the partition number.

Parameters
schema-database-id ID of the Schema database used by the database in which the partition resides.
partition-number The partition number for which to set the query.
query The query to set on the partition.

Example


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. :) 
    
    

Example


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. :) 
    

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