Loading TOC...

MarkLogic 10 Product Documentation
configast:apply

configast:apply(
   $source as item()
) as the output, if any, from the functions of the Admin API

Summary

This function takes the Config AST representation of a server configuration for parsing and processing as a JSON object or XQuery map and applies the configuration using the functions of the Admin API.

Parameters
source The JSON object or map with the Config AST representation of the server configuration.

Usage Notes

The Config AST 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 AST returns the output.

The JSON format of the Config AST is similar to the JSON format of the Optic AST.

Example

import module namespace configAST = "http://marklogic.com/config-ast-json"
	at "/MarkLogic/builder/config-ast-json.xqy";

configAST:apply('

    {"$config":[
        {"ns":"op", "fn":"constdefs", "args":[
          {"name":"db",  "value":{"ns":"xdmp",  "fn":"database",          "args":["Documents"]}},
          {"name":"cfg", "value":{"ns":"admin", "fn":"get-configuration", "args":[]}},
          {"name":"out", "value":{"ns":"map",   "fn":"entry",             "args":[
            "phrase",
            {"ns":"admin", "fn":"database-get-fast-phrase-searches", "args":[
              {"ns":"op", "fn":"constref", "args":["cfg"]},
              {"ns":"op", "fn":"constref", "args":["db"]}
              ]}
            ]}}
          ]},
        {"ns":"op", "fn":"constref", "args":["out"]}
        ]}

')
    

Example

import module namespace configAST = "http://marklogic.com/config-ast-json"
	at "/MarkLogic/builder/config-ast-json.xqy";

configAST:apply('

      {"$config":[
        {"ns":"op", "fn":"constdefs", "args":[
          {"name":"db",  "value":{"ns":"xdmp",  "fn":"database",          "args":["Documents"]}},
          {"name":"cfg", "value":{"ns":"admin", "fn":"get-configuration", "args":[]}},
          {"name":"out", "value":{"ns":"map",   "fn":"entry",             "args":[
            "phrase",
            {"ns":"admin", "fn":"database-get-fast-phrase-searches", "args":[
              {"ns":"op", "fn":"constref", "args":["cfg"]},
              {"ns":"op", "fn":"constref", "args":["db"]}
              ]}
            ]}}
          ]},
        {"ns":"op", "fn":"constref", "args":["out"]}
        ]}

')
    

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