marklogic

How to get file extension in Marklogic Server?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 04:29:09
问题 I want to get the file extension of uploaded file in Marklogic server. I know how to get the file name. But that gives filename plus extension like new.txt. But I want only extension not the full file name. How can I get just the file extension ? 回答1: There are many methods of getting file extensions from filename. For instance you can use functx:substring-after-last($filename, '.') or other methods (fn:substring-after) of getting substring after dot. Please see: xqueryfunctions.com P.S. fn

Using SQL in Query Manager in MarkLogic

浪尽此生 提交于 2019-12-25 04:05:22
问题 After inserting few XML records in ML8, I was able to query them using XQuery through Query Console.. Lets say following XML's are there: Say one XML contains data like: <?xml version="1.0" encoding="UTF-8"?> <Providers> <Provider> <ProviderId>1111</ProviderId> <Name>John Doe</Name> <Age>40</Age> <Country>MN</Country> </Provider> <Provider> <ProviderId>2222</ProviderId> <Name>Jane Doe</Name> <Age>42</Age> <Country>MS</Country> </Provider> </Providers> There is an option to use SQL in query

Has anyone successfully implemented Narthex from marklogic.com?

拟墨画扇 提交于 2019-12-25 03:33:32
问题 I'm liking what I read about Narthex, but the bug list looks a touch scary, the reliance on a specific server install doesn't make me leap for joy, and the setup is a bit over my head. What I'd ideally like to know is whether or not I should invest time in not just trying this project out but learning how to implement it. My immediate and future needs require something like Narthex to aid in the creation of interfaces and collections of learning material, it would be in a controlled usage

How to insert a new ELEMENT after a node in XQuery?

亡梦爱人 提交于 2019-12-25 03:29:12
问题 I want to insert a node using below code but if i will rerun the code i don't want my node to be repeated twice if all the elements are having same value- let $doc := fn:doc("abc.xml") (: abc.xml looks like-- <root> <value1>somevalue</value1> <value2>somevalue</value2> <value3>somevalue</value3> <value4>somevalue</value4> <Country>Australia</Country> <value6>somevalue</value6> <value7>somevalue</value7> <value8>somevalue</value8> <value9>somevalue</value9> <value10>somevalue</value10> </root>

validate document against xsd using rest api : marklogic

狂风中的少年 提交于 2019-12-25 03:08:46
问题 I am using PUT method of document rest api for inserting document but I want to validate xml document before ingestion using schema if it fails I have to report it back. How can I achieve this within Marklogic using rest api similiar to xdmp:validate() in xquery ? I have come across approach like pre-commit triggers, creating rest transformation etc..looking for your inputs. 回答1: Pre-commit triggers are more difficult to configure, and take more overhead. I'd go for a rest transform. That

search latest document from multiple collection

你说的曾经没有我的故事 提交于 2019-12-24 21:46:15
问题 There are 2 collections /test/123 and test/567 I want to return the latest document of both the collections. let $a := cts:collection-match("/test/*") for $t in $ a let $latest :=( for $doc in fn:collection( $t) order by $doc//timestamp descending return $doc)[1] return fn:concat($latest//id/text(),",",$latest//timestamp/text()) Is there a better to get the latest document from the collections I want the final output of query after searching both the collection to be in descending order for

MarkLogic Java: Set Query Type to Value in StringQueryDefinition

淺唱寂寞╮ 提交于 2019-12-24 12:17:09
问题 I'm using the MarkLogic Java API. I'm looking for a way to set the Query Type of a StringQueryDefinition. The type should be "Value", as described in: https://docs.marklogic.com/guide/search-dev/searchdev#id_34905. Value: Match an entire literal value, such as a string or number, in a specific JSON property or XML element. By default, value queries use exact match semantics. For example, a search for 'mark' will not match 'Mark Twain'. I need this because I want my text searches to match only

return latest document based on a element in marklogic

血红的双手。 提交于 2019-12-24 12:12:12
问题 There is a collection with 4 documents. I want to retrieve the document with latest timestamp. The below query helps to sort in descending order but I want the latest modified document for $doc in fn:collection("/test") order by $doc//timestamp descending return $doc//id/text(),",",$doc//timestamp/text()) Output 1234, 2018-03-05T11:29:42.722Z 5678,2018-03-05T11:29:42.715Z 8976,2018-02-05T11:28:42.710Z 8976,2018-02-04T11:28:42.716Z 回答1: Your for loop is already generating a sequence, so all

MarkLogic: Understanding searchable and unsearchable queries?

只谈情不闲聊 提交于 2019-12-24 07:07:27
问题 I have the following expression: let $q1 := cts:element-range-query(xs:QName("ts:week"), ">=" ,xs:date("2009-04-25")) return cts:search(fn:doc(), $q1, "unfiltered") I did a xdmp:plan , and got to know that range indexes are being used and the expression is searchable However, when I added a XPath: let $q1 := cts:element-range-query(xs:QName("ts:week"), ">=" ,xs:date("2009-04-25")) return cts:search(fn:doc(), $q1, "unfiltered")/ts:top-song/ts:title/text() On doing a xdmp:plan , it told me the

MarkLogic - mlcp export to a single output file

纵然是瞬间 提交于 2019-12-24 05:57:49
问题 MarkLogic version 9.0-6.2 mlcp version 9.0.6 I have a customer collection with each document having a customer root node, as below. <customer> <customerId>123</customerId> .... </customer> My need is to export all documents in the collection into one single output file under a new root called customerinfo <customerInfo> <customer> <customerId>123</customerId> .... </customer> <customer> <customerId>456</customerId> .... </customer> </customerInfo> Using below code, I am able to export the