marklogic

Is there any frame work for Marklogic to write javascript code?

十年热恋 提交于 2020-01-04 05:28:21
问题 For Marklogic, it's a NoSQL db and powerful server engine. I use *.xqy file to write code before,but marklogic 8 has an advanced function is that it can write javascript code directly.For more speed to search at database, I want to transplant the xquery project to javascript project.But there is no existing frame to build my project. Actually, I was use the Roxy frame for my xquery project. And I need the same MVC framework for javascript. 回答1: There’s a lot to untangle here. First, the

Counting all unique words in an unstructured document using index data

北慕城南 提交于 2020-01-04 04:46:18
问题 I've loaded unstructured HTML documents into Marklogic and, for any given document URI, I need a way to use indexes/lexicons to provide a word count for all unique words. For example, say I have the file below, saved under the URI "/html/example.html": <html> <head><title>EXAMPLE</title></head> <body> <h1>This is a header</h1> <div class="highlight">This word is highlighted</div> <p> And these words are inside a paragraph tag</p> </body> </html> In XQuery, I'd call my function passing in a by

How to convert string to date type in MarkLogic?

时间秒杀一切 提交于 2020-01-03 21:50:05
问题 I am currently having some challenge in converting String data type to Date type. I used the MarkLogic JavaScript function xdmp.parseDateTime , but I am always getting the error below: Scenario: Convert "2013-04-21" (string) to 2013-04-21 (date type) Code: let targetDateString = "2013-04-21"; let targetDate = new Date(); targetDate = xdmp.parseDateTime("[Y0001]-[M01]-[D01]", xs.date(targetDate)); Error Info: XDMP-ARGTYPE: xdmp.parseDateTime("[Y0001]-[M01]-[D01]", xs.date("2013-04-21")) --

How to convert string to date type in MarkLogic?

对着背影说爱祢 提交于 2020-01-03 21:47:53
问题 I am currently having some challenge in converting String data type to Date type. I used the MarkLogic JavaScript function xdmp.parseDateTime , but I am always getting the error below: Scenario: Convert "2013-04-21" (string) to 2013-04-21 (date type) Code: let targetDateString = "2013-04-21"; let targetDate = new Date(); targetDate = xdmp.parseDateTime("[Y0001]-[M01]-[D01]", xs.date(targetDate)); Error Info: XDMP-ARGTYPE: xdmp.parseDateTime("[Y0001]-[M01]-[D01]", xs.date("2013-04-21")) --

How to list all the URI of all documents in a directory in marklogic

牧云@^-^@ 提交于 2020-01-03 17:47:05
问题 Hi how can i retrieve the URI of all the documents in directory. I create the below xquery to achieve that but that doesn't helps. for $i in xdmp:directory("/Test/performance/results/","infinity") let $k := document-uri(fn:doc($i)) return <li>{$k}</li> 回答1: For efficiency you should use the URI lexicon. cts:uris((), (), cts:directory-query("/Test/performance/results/","infinity")) See https://docs.marklogic.com/cts:uris for documentation. 回答2: How about: xdmp:directory("/Test/performance

How to return all the results in search:search API?

我们两清 提交于 2019-12-25 16:54:58
问题 I am using search:search API and came across a scenario in which I want all the docs returned. I know it will impact the performance but I can bear this as I know there won't be more than 30-50 docs. I can set the max threshold value which is 50 , but just want to know is there way to return all the results. If in future the count increases I don't need to change the threshold value. 回答1: You can specify a large pageLength, something like 999 or even bigger. I'd go for something smaller

search:search() doesn't return any snippets but /search:response/@total is bigger then zero

北城余情 提交于 2019-12-25 16:39:33
问题 I used this expression to search documents search:search( '(content:"value of imports")', <options xmlns="http://marklogic.com/appservices/search"> <constraint name="content"> <element-query ns="" name="content" /> </constraint> <additional-query>{cts:collection-query("document-binary")}</additional-query> </options> ) And had in result <search:response snippet-format="snippet" total="16" start="1" page-length="10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:search="http:/

How to make a REST GET request (with authentication) and parse the result in javascript?

半世苍凉 提交于 2019-12-25 09:34:23
问题 Due to circumstances beyond my control, Javascript is the only language option available for me. I'm a beginner and am not even sure if I'm approaching the problem in a "recommended" manner. Simply put, a customer has setup a MarkLogicDB server online and has given me read-only access. I can query the server with the HTTP GET protocol to return an XML document that has to be parsed. I've been able to create a curl command to return the data I need (example below); curl --anyauth --user

Does setting Max Time Out in Marklogic 4.2.9 need the server to be restarted?

痴心易碎 提交于 2019-12-25 05:22:45
问题 I am updating the XDBC server configurations on my clustered ML 4.2.9 server using admin:appserver-set-max-time-limit($config,$id,$maxTimeLimit ) admin:save-configuration-without-restart() However, after setting this configuration, MarkLogic specifies 2 ways of persisting this change. admin:save-configuration-without-restart() admin:save-configuration() For 1, The ML documentation states "If you use this function to save any changes that require a server restart ("cold" changes such as App

How to upload docx, xlsx & txt files to Marklogic Server?

和自甴很熟 提交于 2019-12-25 05:01:36
问题 I have a folder which contains doc, docx, xlsx, pdf and txt files. I am uploading all these files into Marklogic with this XQuery:- for $d in xdmp:filesystem-directory("C:\uploads")//dir:entry return xdmp:document-load($d//dir:pathname, <options xmlns="xdmp:document-load"> <uri>{concat("/documents/", string($d//dir:filename))}</uri> <permissions>{xdmp:default-permissions()}</permissions> <collections>{xdmp:default-collections()}</collections> <format>binary</format> </options>) I have also