MarkLogic Server 11.0 Product Documentation
info:load

info:load(
   $dir-path as xs:string,
   [$policy-name as xs:string?],
   [$policy-deltas as element(info:options)?],
   [$database as xs:string]
) as xs:string

Summary

[DEPRECATED] This function does a one-time scan of the named directory path (local filesystem only), and attempts to load the files, spawning multiple transactions if necessary. This collector should be considered stateless; although some lightweight state information is passed via an external variable to the executing module, it is not persistent. Transactions are asynchronous, and order of insertions is not guaranteed.

This function returns a ticket URI that can be used to access status information for that ticket.

Parameters
dir-path Local filesystem path of a set of documents to load.
policy-name The name of a stored ingestion policy. If the name is provided but does not exist, an error is thrown. If no name is provided, a stored default policy is used if available. If neither exists, reasonable global defaults are used.
policy-deltas An options node with a namespace of http://marklogic.com/appservices/infostudio. If it is provided, it is merged with the stored policy, providing the ability to override or supplement stored policy at runtime. See the description of the info:policy-set function for an example options node.
database Name of a database into which content should be inserted. If not provided, defaults to the current context database.

Usage Notes

All documents loaded with info:load are added to a collection with the URI corresponding to the ticket ID returned from the function. For example, if info:load returns /tickets/ticket/123456, then any documents loaded have the collection /tickets/ticket/123456 (in addition to any collections added via the options node or options delta).

Example

  xquery version "1.0-ml"; 

  import module namespace info = "http://marklogic.com/appservices/infostudio"  
      at "/MarkLogic/appservices/infostudio/info.xqy";

  info:load("C:\docs\mydocs", (), (), "testDB")

  (: Loads the contents of the C:\docs\mydocs directory into the testBD database using
     the default policy. :)
     

Example

  xquery version "1.0-ml"; 

  import module namespace info = "http://marklogic.com/appservices/infostudio"  
      at "/MarkLogic/appservices/infostudio/info.xqy";

  let $delta := 
      <options xmlns="http://marklogic.com/appservices/infostudio">
          <uri>
              <literal>http://mydir/</literal>
              <filename/>
              <literal>.</literal>
              <ext/>
          </uri>
      </options>

  return info:load("C:\docs\mydocs", (), $delta, "testDB")

  (: Loads the contents of the C:\docs\mydocs directory into the testBD database at the
     URI http://mydir/, using the rest of the options specified by the default policy. 
     For example, C:\docs\mydocs\mydoc.xml will be loaded into the database with the 
     URI http://mydir/mydoc.xml. :)
     
Powered by MarkLogic Server | Terms of Use | Privacy Policy