# Editing keyword lists externally and re-importing



## SaraLH (May 23, 2019)

We recently returned from a long vacation and I have several thousand photos to keyword. In the process of doing that I'd like to clean up and revamp my (heirarchical) keyword list - a continuous work in progress. I exported my keywords a txt file, opened it with a text editor and deleted the brackets around a bunch of keywords that should indeed be exported. I then re-imported the file and it did nothing. None of my changes were implemented. I could swear I remember that this used to function. Am I remembering wrong? What did I do wrong? I have read many sites and posts and can't seem to find a clear answer.

I know that if I completely delete my existing keyword list (after making a catalog backup!) and import the altered list, the altered list will (should) be correctly imported. If I do this will I lose my existing keywords? My catalog contains roughly 50,000 photos of which 75% are DNGs and the other 25% are jpgs or tiffs. So no sidecar files. 

Any help would be appreciated.

P.S. I'm a retired IT-Admin so I'm pretty adept at software-ish stuff.


----------



## clee01l (May 23, 2019)

SaraLH said:


> .
> 
> P.S. I'm a retired IT-Admin so I'm pretty adept at software-ish stuff.


Deleting the existing keyword in the list will remove the assignment connection  between that keyword and the image. Importing a list of keywords from a text file will result in a new  keyword with an identical  Character string"  Each keyword is assigned a unique index value.  So, if you import a keyword list, these will get a new index value  and not replace the older keyword that contains the identical character string.

The only way to "fix" the existing keywords is to update the attributes in the existing keyword list in the database.  If you were  database literate you could probably update the related database tables  without going into LR and doing it one record at a time.   Without a full understanding of the internal tables in the relational database that is the Lightroom Catalog one (and that includes me, a former database analyst) would probably corrupt the Lightroom database file.


----------



## SaraLH (May 23, 2019)

Thanks for the prompt answer Cletus. Unfortunately it's exactly as I feared. Ugh. 

Actually, though I would not be at all shy about making a copy of my catalog and trying to edit the table values. Over the years I have done quite a bit of work building relational databases in Access (as a DB pro you may scoff, but they work) and I also have a certain amount of experience with SQL Servers and databases. 

It would be truly wonderful if our friends at Adobe someday paid a little attention to the poor neglected Library module (oh yeah, a year ago they gave us colored folder tags, whoopie). My hopes are dashed anew at every update release.


----------



## PhilBurton (May 23, 2019)

clee01l said:


> Deleting the existing keyword in the list will remove the assignment connection  between that keyword and the image. Importing a list of keywords from a text file will result in a new  keyword with an identical  Character string"  Each keyword is assigned a unique index value.  So, if you import a keyword list, these will get a new index value  and not replace the older keyword that contains the identical character string.


Cletus,

Let me see if I understand you correctly.  Let's say I have this hierarchy snippet and I have applied the keywords California and San Francisco to a bunch of photos

United States
   California
       San Francisco

And now I want to add a whole bunch of states, e.g. New York, Texas, Illinois, plus some cities in each new state, plus some more cities in California.  so I export the keyword list to a TXT file.  Note that I haven't touched that snippet above.  Then I use Notepad in Windows to make those additions, no brackets for exclude export or the other kind of brackets for synonyms.  Now I re-import that expanded list.    Are you saying that someone Lightroom will interpret the California and San Francisco keywords as "new"?  So that if  then moved California from the top level keyword United States to a new top level keyword USA, Lightroom would not recognize this change for all photos keyworded before I did the export-re-import operation?

Phil Burton


----------



## clee01l (May 24, 2019)

SaraLH said:


> Actually, though I would not be at all shy about making a copy of my catalog and trying to edit the table values.


The Catalog file is a SQLlite database and there are several database managers that can open the file  to edit.  Working with a copy, you can take a look at the internal tables and especially the tables related to keywords.  If it is as simple as it could be , you might need to update only one table and the record for your keyword might consist of fields representing flags for "Will Export"  and other attributes. Changing that field might be what you need to toggle the "Will Export" on or off. This could be how the app interprets the brackets when importing a text file.


----------



## clee01l (May 24, 2019)

PhilBurton said:


> And now I want to add a whole bunch of states, e.g. New York, Texas, Illinois, plus some cities in each new state, plus some more cities in California. so I export the keyword list to a TXT file.


You don't need to export to do this.  In LR simply Drag "California" and drop it on top of "United States"  Drag "San Francisco" and drop it on top of "California"
Add states under "United States" and cities under each state.
I think it is better to add these unassigned keywords in LR as it amounts to the same amount of typing.
FWIW, if you are doing most of your photography in one state, you might want to add County keywords under the state and cities and towns under that.  (The exception to that would be Virginia where some dozen or so cities are not a part of a county but a separate entity.


----------



## Califdan (May 24, 2019)

When I had a similar issue (LR 4?),  I too soon discovered that re-importing  a fixed up exported keyword text file was a non start and caused such a mess that I had to revert to a backup catalog (which i was smart enough to take just before the import keywords).  I've had a feature request in for several years now to have a true export keywords feature that includes all the keyword options and a way to make changes to the exported file outside of LR and then Import that list and have it perform add/change/delete operations as indicated in the text file.  As an IT executive, and old DBA, I know this can be done with a little effort but I'm not holding my breath that Adobe will ever deem it worthy.

So, next best choice short of hacking the catalog database is to export the KW list and open it in Word or Excel.  Then put the Word or Excel window side by side with the LR window on the desktop and use it as a guide to manually fix errant KW's one by on in the LR window.  Still have to do them one by one but at least by looking at the txt file you can see which ones need fixing  without having to select "edit" on each one to see the check boxes.  

When I did this I also adopted a habit (rule for myself) to always append "[NO EXP]" to the end of any keyword on which the "will export" check box is unchecked.  So now at least I can see this attribute in the Keyword List panel without having to open the edit screen for each one individually.   

It sure would be nice if the Keyword List panel showed the value of the 4 check boxes with a series of mini icons next to the image count value in the Keyword list panel  but that's hoping for too much.

dan


----------



## PhilBurton (May 24, 2019)

This thread has been a real eye-opener for me.  One of the reasons for doing export/re-import was to do add new keywords in a batch in the text editor.  Now I know that this approach would be dangerous at best.  I will jsut have to think of creative ways to import an entire new list into LR and then drag it to the right subfolder if necessary.

The one exception to this approach is the list of keywords to be applied at import.  That list gets stored in my IMPORT preset, so I can always change it an update the preset.

Phil


----------

