Skip to content

fix: search full keyword tree before creating duplicates#216

Closed
Olioli4 wants to merge 1 commit into
LrGenius:mainfrom
Olioli4:fix/full-tree-keyword-search
Closed

fix: search full keyword tree before creating duplicates#216
Olioli4 wants to merge 1 commit into
LrGenius:mainfrom
Olioli4:fix/full-tree-keyword-search

Conversation

@Olioli4

@Olioli4 Olioli4 commented Jul 5, 2026

Copy link
Copy Markdown

Description

When the LLM returns a keyword at root level (not nested under a hierarchy category), findKeywordByNameInParent() only searches under the given parent (or root when parent is nil). It never finds the keyword if it already exists deeper in the catalog hierarchy, causing a duplicate to be created at root level.

Changes

Plugin (Lua)

  • MetadataManager.lua: Added findKeywordInFullTree() that recursively traverses the entire catalog tree by name. Used as a fallback in resolveAndAttachKeyword() before creating a new keyword. The name-to-keyword index is cached per session for performance.

Related Issues

Closes #214

When the LLM returns a keyword at root level that already exists
in a hierarchy branch (e.g. 'Fruehling' exists under 'Jahreszeiten'),
findKeywordByNameInParent() fails to find it because it only searches
under the given parent. This causes duplicate keywords at root level.

Add findKeywordInFullTree() that recursively traverses the entire
catalog tree and caches the name-to-keyword index per session.
Use it as a fallback in resolveAndAttachKeyword() before creating
a new keyword.

Refs: LrGenius#214
@Olioli4

Olioli4 commented Jul 5, 2026

Copy link
Copy Markdown
Author

Closing - the fix does not work as expected. The full-tree search approach has issues with Lightroom SDK keyword resolution.

@Olioli4 Olioli4 closed this Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keywords created as duplicates at root level instead of reusing existing hierarchy entries

1 participant