We are using XQuery for MarkLogic query before. And we want to replace with Java as it more widely used.
Everything is fine before I meet with the module query.
import module namespace ent = "http://xxx.xx/model/entitlements" at "/Entitlements/entitlements.xqy";
And in the Xquery, we are using below.
let $final-query := ent:query($query, $cvUserId)
let $docs := cts:search(/, $final-query)
return $docs
ent:query(xx,xx) is in our Linux server which we can't get the source code. As the name side, this query will do entitlement check when execute the search.
I have write below Java code to get the result.
QueryManager queryManager = markLogicClient.newQueryManager();
StringQueryDefinition queryDef = queryManager.newStringDefinition("OPTIONS");
queryDef.setCriteria("Title:test");
XMLDocumentManager dManager = markLogicClient.newXMLDocumentManager();
DocumentPage docs = dManager.search(queryDef, 1, new DOMHandle());
dManager.search(queryDef, 1);
It works well for my test, but without the entitlement check.
Is there any to apply my own query ent:query(xx,xx) with Java ?
Marklogic-8 & marklogic-client-api-4.0.4