Lightroom: Read Metadata From File incorrectly handles ">" and [less than] in keywords

  • 2
  • Problem
  • Updated 12 months ago
  • (Edited)
Metadata > Read Metadata From File incorrectly handles "<" and ">" in keywords, treating them as a hierarchical keyword separator rather than as part of the keywords.  To reproduce:

1. In the Keyword List panel, click "+" and create a top-level keyword named "A>B". 

2. Assign that keyword to a photo p.jpg that doesn't have any other keywords assigned.  Observe the the Keyword List panel shows ">" as part of the keyword:



3. Do Metadata > Save Metadata To File.

4. Use ExifTool to verify the keyword is correctly written to the file's metadata:
$ exiftool -xmp:subject -xmp:hierarchicalsubject -iptc:keywords p.jpg
Subject                         : A>B
Hierarchical Subject            : A>B
Keywords                        : A>B
5. Remove p.jpg from the catalog without deleting it from disk.

6. Reimport p.jpg into the catalog.

7. Observe that the keyword "A>B" is assigned to p.jpg, as shown in step 2.

8. Do Metadata > Read Metadata From File.

9. Observe that "A>B" is no longer assigned to p.jpg and that LR has created and assigned the hierarchical keyword A > B to the photo:



10. Repeat steps 1-9 for the keyword "A[less than]B".

Tested on LR 7.0.1 / MacOS 10.12.6.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3857 Posts
  • 1014 Reply Likes

Posted 12 months ago

  • 2
Photo of Rikk Flohr

Rikk Flohr, Champion

  • 1373 Posts
  • 335 Reply Likes
Photo of Peter Astle

Peter Astle

  • 22 Posts
  • 4 Reply Likes
I use < and > characters in keywords in Bridge e.g. <B>; <CoH>; <F> etc. (which all mean something to me!) 

When images containing these keywords are imported into Lightroom, the < and > characters are stripped, becoming:


The required characters can be added afterwards in Lightroom or the keyword tags created can be edited to include them.  It is the import procedure which strips these characters.
I realise that these characters are not permitted in file names, but they are not precluded from keywords.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3857 Posts
  • 1014 Reply Likes
It's not all imports that cause the problem, just imports of photos that don't contain the field XMP:HierarchicalSubject, which cause "<" and ">" to be misinterpreted as heirarchical separators. 

As discussed in the other forum's thread, Peter is adding keywords using Bridge's IPTC (IIM, legacy) panel, which adds the keywords to XMP:Subject and IPTC:Keywords but not to XMP:HierarchicalSubect, thus triggering this bug.

But when you add keywords using Bridge's Keywords panel, it also adds them to XMP:HierarchicalSubject, avoiding this bug.

Bridge's behavior here is undocumented and probably buggy too.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3857 Posts
  • 1014 Reply Likes
To summarize: 

Importing photos with keywords containing "<" and ">" causes this bug only if the keywords are not stored in XMP:HierarchicalSubject.

Invoking Metadata > Read Metadata From File causes this bug regardless of which metadata fields the keywords are stored in.