Posts

Showing posts from June, 2022

What is the basic difference between xdmp:spawn and xdmp:invoke a function in Marklogic.

 Aha..... Before understanding  xdmp:spawn-function and xdmp:invoke-function in Marklogic, we need to understand synchronous & asynchronous terms. Also, we need to know what is the main server, task server, and Transactions in the Marklogic. So I'm posting here the simple definition of each term that I mentioned here.  Synchronous and Asynchronous Task: Synchronous : In synchronous operations tasks are performed one at a time and you can't move the following task until the current task is finished. Asynchronous : In asynchronous operations, you can move to another task before the previous one finishes. Main Server : Task server: Transactions: Now,  We need to know what  asynchronous  functions &  asynchronous  functions in Marklogic are: Asynchronous Functions: xdmp:spawn : Place the specified module/query on the task queue for evaluation. This function places the specified module in the task queue to be processed. The module will be eva...

What is difference between xdmp:estimate and fn:count?

  Ans: Both functions are used for counting the fragments in Marklogic. The xdmp:estimate is fast because it measures through the index and fn:count function also counts the item but also validates in the index and document. But it is not guaranteed that xdmp:estimate & fn:count give the same result. Sometimes xdmp:estimate can give a false result. So fn:count function works slowly as compared to xdmp:estimate. Let's understand in deep, why fn:count & xdmp:estimate results are not the same.  Step-1: Upload below book catalog XML in Marklogic DB. <? xml version="1.0" encoding="UTF-8" ?> < catalog > < book id =" bk101 " > < author > Ralls, Kim </ author > < title > XML Developer's Guide </ title > < genre > Computer </ genre > < price > 44.95 </ price > < publish_date > 2000-10-01 </ publish_date > < description > An in-depth loo...