Loading TOC...

configdsl.apply

configdsl.apply(
   source as String
) as the output, if any, from the functions of the Admin API

Summary

This function takes the Config DSL representation of a server configuration for parsing and processing as a string or text and applies the configuration using the functions of the Admin API.

Parameters
source The string or text node with the Config DSL representation of the server configuration.

Usage Notes

The Conig DSL builds the configurations with the same functions used in the Admin API. Namespaces are all predefined including the admin namespace for the Admin API functions. The final operation in the DSL returns the output.

the Config DSL is similar to theQuery DSL for Optic API in the Application Developer's Guide

The same JavaScript syntax is the same in the Config DSL as in the Query DSL.

The vocabulary (including expression functions) is the same in the Config DSL and Query DSL with the following exceptions:

The conveniences are the same in the Config DSL and Query DSL with the following exceptions:

The Config DSL supports the two functions provided by the Admin API to apply configuration changes: saveConfiguration() and saveConfigurationWithoutRestart().

Thus, a single DSL can save configuration to create the precondition for a subsequent configuration. For instance, a single Config DSL can save a series of configurations that create forests, create databases that use the forests, and then create appservers that use the databases.

In this respect, the Config DSL differs from the Query DSL, which builds a query for execution or other processing in the Optic API.

The apply() function throws an error if the Config DSL contains:

Example

import configDSL from '/MarkLogic/builder/config-dsl-js.mjs';

configDSL.apply(`

const db = xdmp.database('Documents');
$a.databaseSetFastCaseSensitiveSearches(db, true)
  .databaseSetFastDiacriticSensitiveSearches(db, true)
  .databaseSetFastPhraseSearches(db, false)
  .saveConfiguration();

`);
    

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