Loading TOC...

admin:database-add-geospatial-region-path-index

admin:database-add-geospatial-region-path-index(
   $config as element(configuration),
   $database-id as xs:unsignedLong,
   $geospatial-region-path-indexes as element(db:geospatial-region-path-index)*
) as element(configuration)

Summary

This function adds a geospatial region path index to the specified database in the configuration.

Parameters
$config A configuration specification, typically as returned from one of the Admin module functions.
$database-id The ID of the database (for example, xdmp:database("myDatabase")).
$geospatial-region-path-indexes A geospatial path index specification, typically the result of calling admin:database-geospatial-region-path-index.

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/admin/database

http://marklogic.com/xdmp/privileges/admin/database/{id}

http://marklogic.com/xdmp/privileges/admin/database/index

http://marklogic.com/xdmp/privileges/admin/database/index/{id}

Usage Notes

The index is not created until you pass the modified configuration to admin:save-configuration. You can also pass the returned configuration to another Admin API function to make additional configuration changes.

Example


xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
          at "/MarkLogic/admin.xqy";

let $config := admin:get-configuration()
return admin:save-configuration(
  admin:database-add-geospatial-region-path-index(
    $config, admin:database-get-id($config, "geo"),
    admin:database-geospatial-region-path-index(
      "//kml:LinearRing/kml:coordinates",
      "wgs84", 2, "reject", "miles")
  )
)

(: Adds a geospatial region path index to the database named "geo". :)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.