I have 2 environments with mostly the same keywords, but the small differences are making Content Porter unhappy, which is making me unhappy. The failed Content Porter imports are mostly related to keywords missing.

I'm thinking to get a list of the keywords of both environments (in XML?). Then I can fix them manually, or maybe write a Core Service script to compare the lists, fix any CaSe differences, and also create the new ones (in the destination system).

Anybody done this before or something similar? Other approaches or ideas?

I also tried to do a Search for keywords in the categories and keywords, with '*', but one system returned invalid search results, so that's not an option.


You can use core service for this. Categories and keywords do not have version or history, so it shouldn't be complicated.

I would suggest on first time sync, create a mapping between the keyword synced like have the tcm id of the keyword as a property on source and target where source has target tcm as a property while target has the source.

Once you build the mapping it is very easy to execute sync on keywords via core service since you exactly know which one to update. Also, when you sync via core service get the list, find the mapping and sync. If for a keyword mapping doesn't exist check if parent is mapped that way you will exactly know where to create the new keyword during sync.

If the keyword has been moved to a different parent (one which was already mapped), you will be able to find using the parent mapping and cut and paste the keyword to the new parent in the target. Hope this helps

| improve this answer | |

What differences are you talking about and what make it fail? Do you use filters during import or export so keywords are not in the package? Why not use content porter to migrate the category first (and hopefully fix the issues) and then proceed with your original import?

I would stay away from Core Service with this one as recreating keyword requires quite a lot of work, like determine the metadata schema, all the links in metadata, related keywords, parent keywords and then hope that the keyword you get is good enough to be deemed the same as on target environment? I hope you don't have app data on keywords?

| improve this answer | |
  • The keywords only have Titles and Keys. Keywords are mandatory in some cases, so I must have them in the package unfortunately. I tried to migrate only the category and keywords by themselves, but I get UniquenessExceptions. I'm thinking to get 2 lists of Keywords and then manually add and fix the missing ones. And, no AppData on the keywords, they're simple ones. – robrtc Jun 9 '15 at 13:35
  • How big is the category? Is deleting it completely and restoring it using CP from another system is an option? – Andrey Marchuk Jun 9 '15 at 13:52
  • It's used by a lot of Components, so I'm also not so lucky there either... – robrtc Jun 9 '15 at 13:55

The biggest problem that you're likely to encounter is that you can't have two Keywords with the same Name within the same Category (including in child Publications).

For example, if you're source has the following structure:

Location > Europe > Great Britain > England

and your destination already has the following structure:

Location > Europe > England

Then you will get errors when trying to import the Keyword England.

However, presumably you will want to keep references to these Keywords that already exist in your destination system, so deleting (or renaming) the existing Category probably isn't an option.

Therefore, I'd suggest that your idea of having a Core Service tool to perform these checks (and any additional logic - such as normalising CaSing) seems like the best idea.

Alternatively, you could do these manually or (if possible) do a Content Manager database refresh between environments.

| improve this answer | |

Your Answer

