I need to build a pathRangeQuery for a path with namespace. This is possible in MarkLogic 9 by using the cts.rangeQuery
and building a cts.reference
.
Ex ML9 :
var qname = fn.QName("http://mynamespace.com/example","name");
var elRef = cts.elementReference(qname, ["type=string", "collation=http://marklogic.com/collation/codepoint"]);
var q = cts.rangeQuery(elRef,'>=','myname');
Unfortunately, I can't find the equivalent in MarkLogic 8.
Do you have an idea how to do it ?
Correct, cts:range-query
and cts.rangeQuery
were introduced in MarkLogic 9. In older versions you need to use the more specific range-query functions, like:
http://docs.marklogic.com/8.0/cts.pathRangeQuery
and
http://docs.marklogic.com/8.0/cts.elementRangeQuery
When using namespaces however, the latest note is to use cts.rangeQuery
instead of cts.pathRangeQuery
. That is not an option with MarkLogic 8. With XQuery, you could have just declared a namespace in your XQuery code, and you would have been good, but that is not an option in SJS either.
You'll need to declare the namespace on app-server or group level to make it work in MarkLogic 8.
HTH!