You have to use admin:database-add-path-namespace first to add it to your configuration (the path-namespace just creates the path specification, not the configuration). Something like this:
xquery version "1.0-ml"; import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy"; let $config := admin:get-configuration() let $dbid := xdmp:database("Documents") let $ns := admin:database-path-namespace("foo", "foo") let $config := admin:database-add-path-namespace($config, $dbid, $ns) let $pathspec := admin:database-range-path-index( $dbid, "string", "/a/foo:b/c", "http://marklogic.com/collation/", fn:false(), "ignore") return admin:database-add-range-path-index($config, $dbid, $pathspec) -Danny From: [email protected] [mailto:[email protected]] On Behalf Of Jakob Fix Sent: Wednesday, February 20, 2013 2:27 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] how to declare a namespace for a range path index? Thanks Sujith (and Evan!), that explains it very well, and indeed it is a very useful feature. However, I just looked over the script we use again, and the namespace has been previously declared: let $config := admin:database-add-path-namespace($config, $dbid, admin:database-path-namespace("oe", "http://www.oecd.org/metapub/oecdOrg/ns/") ) let $config := admin:database-add-range-path-index($config, $dbid, admin:database-range-path-index($dbid, "string", "/oe:item/@type", "http://marklogic.com/collation/", fn:false(), "reject") ) Any idea why this threw the abovementioned error? ADMIN-BADPATHNAMESPACE: (err:FOER0000) Undefined path namespace(s): oe. cheers, Jakob. On Wed, Feb 20, 2013 at 11:04 PM, Sujith <[email protected]<mailto:[email protected]>> wrote: Hi Jakob, you can even refer to marklogic blog (Evan Lenz). It has with examples. http://developer.marklogic.com/blog/path-range-indexes http://developer.marklogic.com/blog/path-range-indexes-2 On Wed, Feb 20, 2013 at 4:55 PM, Danny Sokolsky <[email protected]<mailto:[email protected]>> wrote: Hi Jakob, You need to create a Path Namespace for your prefix, then you can use that prefix in your path index. Here is the procedure: http://docs.marklogic.com/guide/admin/range_index#id_54948 -Danny From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Jakob Fix Sent: Wednesday, February 20, 2013 1:50 PM To: General Mark Logic Developer Discussion Subject: [MarkLogic Dev General] how to declare a namespace for a range path index? Hi, I'm trying to create a range path index using a namespace prefix which should be possible. There doesn't seem to be a place to define the namespace for the element(s). Trying "/oe:item/@type" returns this error in the admin interface: Invalid input: Undefined namespace prefixes: oe. I tried the clark notation (you never know): /{http://www.oecd.org/metapub/oecdOrg/ns/}item/@type<http://www.oecd.org/metapub/oecdOrg/ns/%7ditem/@type> which returns another error message: Invalid input: XDMP-UNINDEXABLEPATH, invalid path expression. Running this script https://gist.github.com/jfix/4999929 also returns an error (with or without the namespace declaration): ADMIN-BADPATHNAMESPACE: (err:FOER0000) Undefined path namespace(s): oe. Quite obviously, there must be a way to do this, but I can't seem to find it. Thanks for your help. cheers, Jakob. _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general -- Thanks & Regards Sujith _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
