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 pki = "http://marklogic.com/xdmp/pki" at "/MarkLogic/pki.xqy"; | |
| pki:insert-trusted-certificates( | |
| xdmp:document-get("/OurCertificateLocation/DemoLabCA.pem", | |
| <options xmlns="xdmp:document-get"> | |
| <format>text</format> | |
| </options>) | |
| ) |
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 qry="http://marklogic.com/cts/query"; | |
| declare variable $QUERY as cts:query := cts:word-query( ("one", "two") ); | |
| declare function local:get-keys($query as cts:query) as xs:unsignedLong* { | |
| fn:distinct-values(fn:data(xdmp:plan( cts:search(doc(), $QUERY ) )//qry:key)) | |
| }; |
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"; | |
| declare variable $SIXTEENTH as xs:unsignedInt := 1024; | |
| declare variable $EIGHTH as xs:unsignedInt := 2048; | |
| declare variable $PARTITIONS as xs:unsignedInt := 1; | |
| let $config := admin:get-configuration() | |
| let $groupid := admin:group-get-id($config, "Default") |
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"; | |
| (:~ | |
| : Security Module for creating the Generic Database Users and roles | |
| : | |
| : @version 1.0 | |
| :) | |
| import module namespace sec = "http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy"; |
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"; | |
| (: Take the 3esl.txt file and create a sequence of words :) | |
| declare variable $file := xdmp:document-get("https://path-to-your/3esl.txt"); | |
| let $words := for $i in fn:tokenize($file,"\r?\n") | |
| return concat('"',$i, '"') | |
| return string-join($words,",") |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Marklogic.Xcc; | |
| using Marklogic.Xcc.Exceptions; | |
| namespace ConsoleApplication1 | |
| { |
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-map-by-name($name) { | |
| if ( | |
| fn:exists(xdmp:get-server-field($name)) | |
| ) then ( | |
| xdmp:log(fn:concat("A server-side map with the following name (", $name, ") exists - returning it")), xdmp:get-server-field($name) | |
| ) else ( | |
| xdmp:log(fn:concat("No server-side map was found with the name (", $name, ") - creating it")), xdmp:set-server-field($name, map:map()) | |
| ) |
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"; | |
| for $x in (1 to 20) | |
| return | |
| xdmp:spawn-function(function() | |
| { | |
| for $i at $pos in 1 to 50000 | |
| return xdmp:document-insert( | |
| fn:concat("/", xdmp:random(), ".xml"), |
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"; | |
| (: Configure the $DATABASE variable in the line below :) | |
| declare variable $DATABASE as xs:string := "Documents"; | |
| admin:save-configuration(admin:database-set-expunge-locks(admin:get-configuration(), xdmp:database($DATABASE), "none")) |
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
| SELECT 'Tickets.Ticket ID', 'Tickets.Priority', 'Tickets.Subject', 'Tickets.Creation Date', 'Tickets.Resolved Date', 'Tickets.User', 'Tickets.Owner', 'Tickets.Status' WHERE 'Users.User Organization' = 'MarkLogic' AND 'Tickets.Creation Date' = MONTHRANGE(October 2014, November 2015) ORDER BY 'Tickets.Creation Date' |