Always maintain parent keyword selected

There is currently a preference in the Preference dialog’s Metadata tab called “When assigning keywords, apply whole hierarchy of selected keywords”. I would like to add a new option to always ensure that if an image has a given keyword assigned to it then all the parent keywords are also assigned.

Justification

Some of us neither use nor want the feature in which certain parent keywords can be designated as non-searchable. However, certain Photolab operations can create parent keywords that are not selected. One case is drag-and-drop. Another is through imports.

Keyword Assignment

A keyword is assigned:

  • When a user assigns the keyword to an image.
  • When a user imports keywords from an image.
  • In the last part of a drag-and-drop operation.

The current option only supports assigning parents as per the first bullet.

The algorithm is simple: when keyword X is assigned to an image, assign any parent keywords not already assigned.

Keyword Removal

For logical consistency, a keyword’s parents should be removed when a keyword is removed. This occurs:

  • When a keyword is removed by the user.
  • When keyword is deleted.
  • In the first part of a drag-and-drop operation.

Keyword removal has some ambiguity. In the chain A > B > C, does the removal of C imply the removal of A and B? This is the algorithm I propose:

  • When a keyword is removed, remove all its parents.
  • Inspect the remaining assigned keywords and ensure all their parents are also assigned.

For example, in the case where an image is assigned A > B > C and A > E, if C is removed, then A and B would be removed, and A would be added back (because it is E’s parent).

Leaving B selected would often be the wrong behavior in a drag-and-drop operation. And if the user really wants B assigned, they can always re-assign it.

Let me give another example to clarify why I chose this particular algorithm:

  • The user assigns C in the hierarchy A > B > C. The system automatically assigns A and B.
  • The user immediately changes his mind and removes C. In most cases, this means the user wants to undo not only his action, but any actions that Photolab made on his behalf. Therefore, A and B should be removed. If the user meant to select B, then he can do so explicitly as his next action.

Drag-and-drop

Since I’ve mentioned drag-and-drop, let me give an example of how things should work:

  • I have an image with A > B > C and A > E assigned. Since this example assumes PL has implemented my feature request, we know we will start with all keywords checkmarked.
  • I drag-and-drop the C onto the Y of the hierarchy X > Y. When I start the drag-and-drop, neither X or Y is assigned to the image (i.e. both are unchecked).
  • The first part of the drag-and-drop removes C from the image. The end result is that A and E remain assigned to the image (as described above).
  • The second part of the drag-and-drop places C in the keyword hierarchy under X > Y and assigns C to the image. C’s new parents are also assigned, as per the rule.
  • The final result is that the image has A > E, and X > Y >C, with A, E, X, Y, and C all being checkmarked.

In PL 7.3, the above drag-and-drop would result A, B, E, and C assigned to the image (checkmarked) and X and Y not assigned. Searches for X and Y would not find the image. Paradoxically, searches for B would.

One Caveat

This option cleans up “bad” data coming from other keywording programs (keywords where the parents aren’t selected). If PL also writes the data back out, it might not be exactly what it read in. This could be considered a good thing or a bad thing—PL could be fixing bad hierarchies in the other keywording tools, or it could be breaking things.

If one doesn’t want PL to change the keywords, don’t allow it to automatically update XMP sidecars. If one wants certain keywords to not be found, then don’t enable the proposed option.

Have to re-read the request. It’s a bit too complicated to grasp on a small screen :wink:

Nevertheless, not selecting an intermediate keyword would then make it a category according to MWG.

Good catch!

I this mode, you would not be allowed to de-select a parent keyword.

There’s one more thing: if you turn the mode on, PL needs to check the database and update any files that need parent keywords added. It could take a long time or it could be a quick operation. For most of the people who want this, there might be only a few images to fix.

However, PL should determine how many files need to be updated and warn the user before starting the operation.