This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
(: | |
Enable ReST API Diagnostic Trace Events | |
See: https://help.marklogic.com/Knowledgebase/Article/View/692/ | |
:) | |
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |
declare variable $config := admin:get-configuration(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: Given a sequence from a range lexicon (on the right), pass the sequence to fn:matches and return all instances containing "A7" :) | |
fn:filter(function($a) { fn:matches($a, "A7") }, cts:element-values(xs:QName("Template"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; | |
if(some $i in xdmp:databases() ! admin:database-get-journaling(admin:get-configuration(), .) satisfies ($i eq "off")) | |
then("FAIL") | |
else("PASS") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare variable $FILES as xs:string+ := ("databases.xml", "hosts.xml", "groups.xml", "assignments.xml", "clusters.xml", "server.xml"); | |
declare variable $FILENAMES as xs:string+ := for $i in $FILES return xdmp:hosts() ! ("file://"||xdmp:host-name(.)||xdmp:data-directory()||"/"||$i); | |
declare variable $ZIPFILENAME as xs:string := "/tmp/ml-configfiles-"||fn:format-dateTime(fn:current-dateTime(),"[Y01]_[M01]_[D01]_[H01]_[m01]_[s01]")||".zip"; | |
declare function local:write-zipfile() { | |
let $zip := xdmp:zip-create( | |
<parts xmlns="xdmp:zip">{for $i in $FILENAMES return element part {$i}}</parts>, | |
(for $i in $FILENAMES return xdmp:document-get($i)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare function local:get-security-users() { | |
xdmp:eval('xquery version "1.0-ml"; | |
import module namespace sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; | |
declare function local:expand-role-roles($roles){ | |
if(not(empty($roles))) | |
then( | |
element ul {attribute class {"parent-roles", $roles}, | |
for $role in $roles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
(: | |
: Get the host/forest configuration | |
:) | |
declare default element namespace "http://marklogic.com/xdmp/status/forest"; | |
declare variable $path as xs:string := '/Users/ableasdale/Downloads/SuppDump20190414'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
for KERNEL in /boot/vmlinuz-*; do | |
grubby --update-kernel="$KERNEL" --args='transparent_hugepage=never' | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace q = "http://marklogic.com/cts/query"; | |
declare variable $QUERY as cts:query := cts:and-query(()); | |
fn:data(xdmp:plan(cts:search(doc(), $QUERY))/q:result/@estimate) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace qc = "http://marklogic.com/appservices/qconsole"; | |
for $i in (//qc:timestamp) | |
where xs:dateTime($i) ge xs:dateTime("2018-06-26T16:06:49") and xs:dateTime($i) le xs:dateTime("2018-06-26T17:06:49") | |
return xdmp:node-uri($i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace qc = "http://marklogic.com/appservices/qconsole"; | |
cts:search(doc(), | |
cts:and-query(( | |
cts:element-range-query(xs:QName("qc:timestamp"), ">=", xs:dateTime("2018-06-26T16:06:49")), | |
cts:element-range-query(xs:QName("qc:timestamp"), "<=", xs:dateTime("2018-06-26T17:06:49")) | |
)) | |
) |