admin.rangeAssignmentPolicy( partition-key as cts.reference, lower-bound-included as Boolean ) as element(db.assignmentPolicy)
This function returns an element that represents the range assignment policy.
Use the
admin.databaseSetAssignmentPolicy
function to set the assignment policy.
const admin = require('/MarkLogic/admin'); // An element range index is already configured. const config = admin.getConfiguration(); const dbId = admin.databaseGetId(config, 'db1'); // Range assignment policy doesn't work with fast locking; use "strict" or no locking instead. const setLock = admin.databaseSetLocking(config, dbId, 'strict'); const ref = cts.elementReference(fn.QName('uri', 'localname')); const rangePolicy = admin.rangeAssignmentPolicy(ref, true); const setAssign = admin.databaseSetAssignmentPolicy(setLock, dbId, rangePolicy); admin.saveConfiguration(setAssign);
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.