Skip to content

Instantly share code, notes, and snippets.

@paxtonhare
paxtonhare / content.xqy
Last active November 9, 2016 15:39
Sample scaffolding output for ES driven content plugin
xquery version "1.0-ml";
module namespace plugin = "http://marklogic.com/data-hub/plugins";
import module namespace es = "http://marklogic.com/entity-services"
at "/Marklogic/entity-services/entity-services.xqy";
declare option xdmp:mapping "false";
(:~
<export><workspace name="json-tree-walker"><query name="INSERT-DOCS" focus="false" listorder="1" taborder="1" active="true" database="12188229314415601684" server="3177585694450821129" database-name="Documents" server-name="App-Services" mode="xquery">(: Insert our Test Documents :)
(: a document with an object node at the root :)
xdmp:document-insert('/test.json', xdmp:unquote('{
"string": "a string value",
"boolean-false": false,
"boolean-true": true,
"number-negative": -123,
"number-positive": 123,
"null": null,
@paxtonhare
paxtonhare / check-for-gzip.xqy
Created April 5, 2012 18:32
GZip compression in the browser using MarkLogic 5.0-3 and greater
if (fn:contains(xdmp:get-request-header("Accept-Encoding", ""), "gzip")) then
(: do your gzipping here :)
else
(: don't gzip :)