
tieredstorage.partitionSetQuery( schema-database-id as (Number|String), partition-number as Number, query as cts.query ) as null
This function sets the query for a partition specified by the partition number.
// 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')));
// 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')));
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.