Class LrKeyword

This class provides access to a Lightroom keyword, any contained keywords, and photos associated with the keyword.

Access the functions and properties from the object. Retrieve the objects for all the keywords by calling LrCatalog.getKeywords().

Summary

Reports the type of this object.
Retrieves the attributes of this keyword.
Retrieves the children of this keyword, if any.
Retrieves the name of this keyword.
Retrieves the parent of this keyword, if any.
Retrieves the photos that have this keyword.
Retrieves the synonyms for this keyword.
keyword:setAttributes( keywordInfo )
Sets attributes for this keyword.
keyword:setParent( parent )
Sets the parent of this keyword.
(LrCatalog) The catalog object that contains this keyword.
(number) The local identifier of the keyword, unique within this catalog.

Functions

keyword.type( _ )
Reports the type of this object.

First supported in version 3.0 of the Lightroom SDK.

Parameters

1. _

Return value

(string) 'LrKeyword'
keyword:getAttributes()
Retrieves the attributes of this keyword.

First supported in version 3.0 of the Lightroom SDK.

Return value

(table) A table of attributes; see setAttributes(). As of Lightroom 6.0, a keywordType attribute may also be present. If the keyord is a face tag, this attribute will be present with the value "person".
keyword:getChildren()
Retrieves the children of this keyword, if any.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(array of LrKeyword) The child keyword objects, or an empty array if there are no children.
keyword:getName()
Retrieves the name of this keyword.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(string) The name.
keyword:getParent()
Retrieves the parent of this keyword, if any.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(LrKeyword) The parent keyword object, or nil if this is a top-level keyword.
keyword:getPhotos()
Retrieves the photos that have this keyword.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(array of LrPhoto). The photo objects.
keyword:getSynonyms()
Retrieves the synonyms for this keyword.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(array of string) The synonyms.
keyword:setAttributes( keywordInfo )
Sets attributes for this keyword.

Must be called from within one of the catalog:with___WriteAccessDo gates.

This call can be used within the same catalog:with___WriteAccessDo call that created this keyword.

First supported in version 3.0 of the Lightroom SDK.

Parameters

1. keywordInfo
(table) A table that contains these fields:
  • keywordName: (string) The name of the keyword.
  • synonyms: (table) The names of synonyms.
  • includeOnExport: (Boolean) True to include the keyword when the photo is exported.
  • ignoreCase: (Boolean) True to ignore the case of the keywords when updating.
If any field is nil, does not change the value of that field.

Return value

True on success, false if there is already a keyword which has the same name and parent.
keyword:setParent( parent )
Sets the parent of this keyword.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 13.0 of the Lightroom Classic SDK.

Parameters

1. parent
(LrKeyword) The new parent of the keyword, or nil to move the keyword to the top level.

Properties

keyword.catalog : (Read-Only)
(LrCatalog) The catalog object that contains this keyword.

First supported in version 3.0 of the Lightroom SDK.

See also: LrCatalog
keyword.localIdentifier : (Read-Only)
(number) The local identifier of the keyword, unique within this catalog.

First supported in version 3.0 of the Lightroom SDK.