If you manually create an instance of db:range-element-index instead of using 
the constructor function, where in the localname element you have a 
space-separated list of the localnames you can do it. (If they have separate 
namespace URIs too, you need to separate them).  You should make sure you have 
something schema-valid per database.xsd.

//Mary

________________________________________
From: [email protected] 
[[email protected]] on behalf of Eliot Kimber 
[[email protected]]
Sent: Monday, July 31, 2017 10:15 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] Possible to Create Multi-Tagname Range Indexes 
Using admin Functions?

Using ML 8 I’m setting up a script to configure a large number of range indexes.

If I do it manually via the UI I can create a single range index configuration 
that lists multiple tag names.

However, this doesn’t appear to be possible with the admin API using 
admin:database-add-range-element-index().

I’m passing multiple range index definitions to a single call of 
admin:database-add-range-element-index() but the result in the UI is still one 
range index configuration per element name:

declare function local:configure-range-element-indexes(
   $config as element(),
   $db-id as xs:integer,
   $datatype as xs:string,
   $namespace as xs:string?,
   $tagnames as xs:string*
) as element() {
   let $indexes as element()* :=
   for $tagname in $tagnames
   return admin:database-range-element-index(
          $datatype,
          $namespace,
          $tagname,
          "http://marklogic.com/collation/";,
          false(),
          "reject")

   let $new-config :=
     admin:database-add-range-element-index(
        $config,
        $db-id,
        $indexes)
   return $new-config
};

Some of these tag name lists are quite long, reflecting logical groupings of 
element types, so it would be nice to have them grouped under single 
definitions in the UI for the benefit of people inspecting the configuration.

Is what I want to do possible?

Thanks,

Eliot

--
Eliot Kimber
http://contrext.com




_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to