Loading TOC...

admin:database-set-tf-normalization

admin:database-set-tf-normalization(
   $config as element(configuration),
   $database-id as xs:unsignedLong,
   $value as xs:string
) as element(configuration)

Summary

This function specifies whether to use the default term-frequency normalization (scaled-log), which scales the term frequency based on the size of the document, or to use the unscaled-log, which uses term frequency as a function of the actual term frequency in a document, regardless of the document size.

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") ).
value The new term-frequency normalization setting. Must be one of: scaled-log or unscaled-log.

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}

Example


  xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()

  let $db := admin:database-get-id($config, "myDatabase")

  return   <apidoc:param name="config" type="element(configuration)">
     A configuration specification, typically as returned
     from one of the Admin module functions.
   </apidoc:param>
   <apidoc:param name="group-id" type="xs:unsignedLong">
     The name of the group.
   </apidoc:param>
      admin:database-set-tf-normalization($config, $db, "unscaled-log")

  (: Sets the term-frequency normalization setting to "unscaled-log" for the
     database, "myDatabase."  Use admin:save-configuration to save the changes
     to the configuration or pass the configuration to other Admin API functions
     to make other changes. :)
        

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