marklogic

Sort documents on the basis of document property using cts:search

眉间皱痕 提交于 2019-12-24 05:56:16
问题 I have document properties for each document - <prop:properties xmlns:prop="http://marklogic.com/xdmp/property"> <prop:last-modified>2017-04-12T04:55:57Z</prop:last-modified> </prop:properties> Now I want to sort my search results using prop:last-modified . One way which I got to know is to use a loop. But this loop will have an impact on the performance of the query. Is there any other way to get the search results with-in MarkLogic only? 回答1: cts:search() allows an order-specification as

Download file, filename

我的梦境 提交于 2019-12-24 05:33:25
问题 I would like to provide a browser with a file download where I set the filename using XQuery . In this example I set the filename to ' example.txt '. The output fiename is: ' docmaker ' and this is not what I want it to be. What is the correct header configuration to accomplish this? declare %roxy:params("ID=xs:number") function strlf:get( $context as map:map, $params as map:map ) as document-node()* { map:put($context, "output-types", "application/csv"), map:put($context, "Content

Execute MLCP Content Load Command as a schedule task in Marklogic

大城市里の小女人 提交于 2019-12-24 04:35:10
问题 Is there any possible way to bulk load data using MLCP as a scheduled task in Marklogic 回答1: You can't invoke mlcp via a scheduled task; I recommend trying something like Apache Camel for this. Camel has a Timer component and a Quartz component, either of which can be used for scheduling. And here's an example Camel file with a route (commented out, but still operable) that is initiated by a Timer which then writes a file to disk and ingests it via mlcp - https://github.com/rjrudin/ml-camel

Which node in a MarkLogic cluster runs the CPF Action Module?

假如想象 提交于 2019-12-24 02:58:09
问题 I have a MArkLogic cluster with 3 nodes: Node 1 Node 2 Node 3 On this clustered environemnt I have a database test which has one forest test-01 . The Primary Host for the forest test-01 is on Node 1 . Also, I have CPF installed on the database test Now, when I insert any document in the database test , the CPF action module will be executed on which Node's Task Server thread? Will the Primary Host of the forest in which the document gets created ALWAYS executes the CPF action module? What If

Dynamic options via client-java-api

烈酒焚心 提交于 2019-12-24 01:06:07
问题 I am creating REST webservice that take parameters via url and search in marklogic based on these dynamic parameters. q=search&offset=0&limit=10& sort=documentId|asc&termAggregations=group:10 I am creating using StructuredQueryDefinition & RawCombinedQueryDefinition : StructuredQueryDefinition queryCriteria = sqb.or(query, sqb.properties(sqb.term(parameters.getQuery)))); String combinedQuery = "<search xmlns=\"http://marklogic.com/appservices/search\">" + queryCriteria.serialize() + options +

Marklogic|NodeJS API - Query on attribute of a field

邮差的信 提交于 2019-12-23 21:11:55
问题 I have a json structure something like { foo:"bar", keyPhrases:[ {key: "random thing", value: 5}, {key: "another random", value: 3} ] } How can i do a word query on keyPhrases.key ? I tried qb.word('keyPhrases.key', 'random') or qb.word(qb.property('keyPhrases.key'), 'random') and it does not work. Any ideas? I know this is possible with a QBE but for the Marklogic NodeJS API you can`t specify a collection, and I need to. 回答1: You need qb.scope(). var ml = require('marklogic'); var conn =

Marklogic 8 xml search

核能气质少年 提交于 2019-12-23 20:57:12
问题 Suppose I have a xml as below: <xx> <yy> <name>A</name> <value>1</value> </yy> <yy> <name>A</name> <value>2</value> </yy> <yy> <name>B</name> <value>1</value> </yy> </xx> Now I want to find if any 'yy' is present with name as A and value as 1. So here the matching content would be: <yy> <name>A</name> <value>1</value> </yy> I am trying to do this by REST call,qbe GET request but not able to do it. Can some one help me out using: /v1/qbe or /v1/search 回答1: With the /v1/search API you'll need

Accessing markLogic from another localhost

情到浓时终转凉″ 提交于 2019-12-23 20:13:28
问题 I am trying to use markLogic as a document repository and to write a client that can access it from my localhost (Apache)... In markLogic, I have created a new REST server (8011) and I now would like to access a markLogic database from the client with a (hopefully simple) HTTP request (actually using jQuery $.ajax). However, the CORS problem rears its ugly head(er). After researching stackoverflow I have modified the $.ajax to include the statement: "crossDomain: true," - however this is not

split document by using MarkLogic mlcp

这一生的挚爱 提交于 2019-12-23 17:12:23
问题 I need to split this document <?xml version="1.0"?> <!DOCTYPE docs SYSTEM "../rom11.dtd"> <docs> <stwtext id="RD-10-00258" update="03.2011" seq="RQ-10-00001"> <head> <ti> <i>j</i> </ti> <ff-list> <ff id="0103" /> </ff-list> </head> <p> Symbol für die <vw idref="RD-19-04447">Stromdichte</vw> . </p> </stwtext> <stwtext id="RD-10-00209" update="12.2007" seq="RQ-10-00223"> <head> <ti>JZ</ti> <ff-list> <ff id="0932" /> </ff-list> </head> <p> Abkürzung für Jod-Zahl, siehe <vw idref="RD-06-00645"

How to grant http://marklogic.com/xdmp/privileges/get-role privilege?

为君一笑 提交于 2019-12-23 12:43:35
问题 I am making a call to sec:role-exists(). I am trying to figure out what permissions are needed to grant this ability to someone other than admin. The error I am getting back implies that I need the http://marklogic.com/xdmp/privileges/get-role privilege. SEC-PRIVDNE: xdmp:security-assert("http://marklogic.com/xdmp/privileges/get-role", "execute") -- Privilege does not exist: action(http://marklogic.com/xdmp/privileges/get-role), kind(execute) However, when I try to grant this role using the