Author Topic: Spaces in keyword hierarchy  (Read 7126 times)

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Spaces in keyword hierarchy
« on: July 07, 2009, 09:35:21 AM »
A few months ago, frustrated with Lightroom's generally plodding nature when doing keywording, I decided to try moving that step over to PM, which I was already using for import.  I exported my keywords from Lightroom and imported them into PM with no issue, and setup up PM in a way that (I thought) would maximize compatibility between the two, as I wanted to continue using Lightroom's DAM capabilities.  Specifically, I set PM to use the | character to denote a keyword hierarchy, as that is read by Lightroom by default (though you can also define a couple other characters if you wish).

Since I was going back and keywording a lot of historical shots (back to 2003, when I started shooting digital), I would do a few months' worth, and then tell Lightroom to read the metadata from the files (everything is using XMP sidecars).  I noticed an issue at the time, but didn't really figure out what was going on until yesterday.  When I imported a batch of photos, keywords that were already in an established hierarchy in Lightroom were coming in separated from that hierarchy.  For instance, if I had already defined Birds | Raptors | Hawks | Red-tailed Hawk in Lightroom, if I read in metadata with that hierarchy applied in PM, it created a second "Birds" top-level keyword, instead of using the established one.

Having finished most of my keywording, I sat down yesterday to reimport all of the metadata in Lightroom, and the whole thing just spiraled out of control.  Duplicate entries everywhere.  After trying to put things back together, it finally occurred to me what had happened when Lightroom popped up a message about not using leading or trailing spaces in keyword hierarchies.  Sure enough, the "duplicate" top-level keywords all had a trailing space after the keyword, and all other keywords that had been applied in PM had similar issues.  If a keyword was in the middle of a hierarchy, it would have leading and trailing spaces;  if it was the last keyword in a hierarchy, it would have only a leading space.

I can't see any way to force PM to omit the spaces that it's inserting in the hierarchies that it creates in the Structured Keywords panel - I have checked the file that I exported from Lightroom, and there are no leading or trailing spaces in the file.  Is there something I'm missing?  If not, could we have a setting somewhere that could omit the spaces in keyword hierarchies going forward?

I'm running a Mac Pro with OS X 10.5.7, 9GB of RAM, using Lightroom 2.4 and PM 4.6.1.

Thanks for any assistance you can provide.


Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Spaces in keyword hierarchy
« Reply #1 on: July 07, 2009, 09:47:53 AM »
Rick,

A few months ago, frustrated with Lightroom's generally plodding nature when doing keywording, I decided to try moving that step over to PM, which I was already using for import.  I exported my keywords from Lightroom and imported them into PM with no issue, and setup up PM in a way that (I thought) would maximize compatibility between the two, as I wanted to continue using Lightroom's DAM capabilities.  Specifically, I set PM to use the | character to denote a keyword hierarchy, as that is read by Lightroom by default (though you can also define a couple other characters if you wish).

Since I was going back and keywording a lot of historical shots (back to 2003, when I started shooting digital), I would do a few months' worth, and then tell Lightroom to read the metadata from the files (everything is using XMP sidecars).  I noticed an issue at the time, but didn't really figure out what was going on until yesterday.  When I imported a batch of photos, keywords that were already in an established hierarchy in Lightroom were coming in separated from that hierarchy.  For instance, if I had already defined Birds | Raptors | Hawks | Red-tailed Hawk in Lightroom, if I read in metadata with that hierarchy applied in PM, it created a second "Birds" top-level keyword, instead of using the established one.

Having finished most of my keywording, I sat down yesterday to reimport all of the metadata in Lightroom, and the whole thing just spiraled out of control.  Duplicate entries everywhere.  After trying to put things back together, it finally occurred to me what had happened when Lightroom popped up a message about not using leading or trailing spaces in keyword hierarchies.  Sure enough, the "duplicate" top-level keywords all had a trailing space after the keyword, and all other keywords that had been applied in PM had similar issues.  If a keyword was in the middle of a hierarchy, it would have leading and trailing spaces;  if it was the last keyword in a hierarchy, it would have only a leading space.

I can't see any way to force PM to omit the spaces that it's inserting in the hierarchies that it creates in the Structured Keywords panel - I have checked the file that I exported from Lightroom, and there are no leading or trailing spaces in the file.  Is there something I'm missing?  If not, could we have a setting somewhere that could omit the spaces in keyword hierarchies going forward?

I'm running a Mac Pro with OS X 10.5.7, 9GB of RAM, using Lightroom 2.4 and PM 4.6.1.

It sounds like a bug to me.  Could you post one of your XMP sidecar files so I could look at it, please?

-Kirk

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #2 on: July 07, 2009, 10:31:42 AM »
Kirk - just uploaded a ZIP file containing an XMP sidecar.  Forgot to change the filename to something logical, so it will appear as 7961_1250_220020.xmp.zip.

Rick

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Spaces in keyword hierarchy
« Reply #3 on: July 07, 2009, 11:28:57 AM »
Rick,

Kirk - just uploaded a ZIP file containing an XMP sidecar.  Forgot to change the filename to something logical, so it will appear as 7961_1250_220020.xmp.zip.

OK, got it.  Can you also send me an XMP file that has things set the way Lightroom likes it?

Thanks,

-Kirk

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #4 on: July 07, 2009, 12:06:47 PM »
I'm going to have to guess at that, since Lightroom doesn't format XMP the same way that it expects it to be formatted if you're importing from somewhere else - that is, after getting everything the way I wanted it in Lightroom, it doesn't actually write out the hierarchy to XMP, but instead just dumps all the individual keywords into the sidecar file.  I guess it just keeps track of the hierarchy internally, not relying on the XMP for hints.

Based on what I've seen (and I just tried a fresh import into a new Lightroom library, with the same results), it wants there to be no spaces in the hierarchy between the keyword and the separator.  So, in the XMP I sent you, where you see USA | CT | West Hartford, it seems to want USA|CT|West Hartford.  The way it is now, on import it produces USA<space>, <space>CT<space>, and <space>West Hartford as keywords.

Rick

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Spaces in keyword hierarchy
« Reply #5 on: July 07, 2009, 01:08:20 PM »
Rick,

I'm going to have to guess at that, since Lightroom doesn't format XMP the same way that it expects it to be formatted if you're importing from somewhere else - that is, after getting everything the way I wanted it in Lightroom, it doesn't actually write out the hierarchy to XMP, but instead just dumps all the individual keywords into the sidecar file.  I guess it just keeps track of the hierarchy internally, not relying on the XMP for hints.

Based on what I've seen (and I just tried a fresh import into a new Lightroom library, with the same results), it wants there to be no spaces in the hierarchy between the keyword and the separator.  So, in the XMP I sent you, where you see USA | CT | West Hartford, it seems to want USA|CT|West Hartford.  The way it is now, on import it produces USA<space>, <space>CT<space>, and <space>West Hartford as keywords.

If you edit the XMP file as a text file and remove the spaces and then save it back out, does Lightroom then pick things up the way you expect?

-Kirk

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #6 on: July 07, 2009, 01:23:48 PM »
Yes, just tested.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Spaces in keyword hierarchy
« Reply #7 on: July 07, 2009, 01:31:18 PM »
Rick,

Yes, just tested.

I've been experimenting with the Structured Keywords Panel, and I have no problem getting just the '|' separator with no spaces.  Just edit the separator and remove the spaces on either side of the '|' character.  And for photos that already have the separator set as ' | ', I was able to use the Find and Replace dialog to search for ' | ' (without the quotes) and replace with '|' (without the quotes) in bulk and repair the files.  I examined the XMP and there were no spaces between the terms.

Give it a try and let me know how it works for you.

-Kirk

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #8 on: July 07, 2009, 01:39:58 PM »
Hmmm, sounds promising.  I don't think I entered spaces in there to begin with, just the | character.  What is the default content of that field in the Structured Keywords panel on installation?  Is it already populated with spaces for some reason?

I'll give this a try this evening and see how it goes.  I just tried it on my laptop, and there are spaces on either side of the |, but I don't think I put them there.

Thanks for the help!
« Last Edit: July 07, 2009, 01:44:09 PM by Rick Baumhauer »

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Spaces in keyword hierarchy
« Reply #9 on: July 07, 2009, 02:29:42 PM »
Hmmm, sounds promising.  I don't think I entered spaces in there to begin with, just the | character.  What is the default content of that field in the Structured Keywords panel on installation?  Is it already populated with spaces for some reason?

I'll give this a try this evening and see how it goes.  I just tried it on my laptop, and there are spaces on either side of the |, but I don't think I put them there.

Thanks for the help!

Yes, the default is set to ' | ' but the feature itself is disabled by default.  The spaces make the keywords much more readable, and that also allows word-wrapping when multiple paths are listed in a text field.  I'm surprised Lightroom treats them in the manner that it does (it's very simple to trim leading and terminating white space!) but we get what we get I guess.

-Kirk

Offline Rick Baumhauer

  • Newcomer
  • *
  • Posts: 47
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #10 on: July 07, 2009, 03:40:06 PM »
Ah, that explains it - I was remembering turning the feature on, not entering the character.  I'm also surprised that Lightroom doesn't do any checking on import, since it knows enough to admonish you if, when renaming a keyword, you leave a leading or trailing space (even one that had existed since import).

Thanks again for the help - I never realized that there were spaces in that box by default, or it wouldn't even have been necessary to start this topic.

Thanks again for being so helpful and responsive, as always.  That's why I started my inquiry here, rather than on Adobe's boards :)

Rick

Offline John Clifton

  • Newcomer
  • *
  • Posts: 1
    • View Profile
Re: Spaces in keyword hierarchy
« Reply #11 on: July 17, 2009, 02:05:46 PM »
Hi Guys

Thanks so much for this post.  I was having exactly the same problem importing hierarchies into a pre-existing Lightroom structure.  Now, having deleted the spaces around the delimiter, and making sure all the keywords in a string are set as keywords, everything appears exactly as it should when I read from XMP in LR.

I will pass the solution on in other fora..

John Clifton
A Nikonian in North Yorkshire