MarkLogic 10 Product Documentation
tieredstorage.partitionSetQuery

tieredstorage.partitionSetQuery(
   schema-database-id as (Number|String),
   partition-number as Number,
   query as cts.query
) as null

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

// Sets the query for partition 1 in the Schemas database.

const ts = require('/MarkLogic/tieredstorage');

declareUpdate();
ts.partitionSetQuery(
  xdmp.database('Schemas'), 
  1,
  cts.elementRangeQuery(
     xs.QName('create-date'), '>',
     xs.dateTime('2014-01-01T00:00:00')));
   

Example

// Sets the query for partition 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.

const ts = require('/MarkLogic/tieredstorage');

declareUpdate();
ts.partitionSetQuery(
   xdmp.schemaDatabase(xdmp.database('Schemas')),
  1,
  cts.elementRangeQuery(
            xs.QName('LastModified'), 
            '>=',
            xs.yearMonthDuration('P1Y')));
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy