Skip to main content
Inspiring
June 16, 2019
Answered

Find images which contain one keyword but not another

  • June 16, 2019
  • 3 replies
  • 762 views

I need to add a keyword to hundreds of photos which contain a certain keyword, but do not contain the keyword I want to add.  How do I search for these images to be updated.  No spaces are involved.

This topic has been closed for replies.
Correct answer JohanElzenga

Create a smart collection with two criteria: keyword does contain A, keyword does not contain B.

Or, in the filter bar: keywords contain A !B. So place an exclamation point before the keyword that should not be present.

By the way: you cannot add a keywords twice, so you can probably just search on keyword A and then add keyword B, regardless of wether the image already contains B or not.

3 replies

johnrellis
Legend
June 17, 2019

I need to add a keyword to hundreds of photos which contain a certain keyword, but do not contain the keyword I want to add.  How do I search for these images to be updated.  No spaces are involved.

Note that the criterion "Keywords contains a" will find all photos having at least one keyword that contains the string "a" anywhere within a keyword. For example, "Keywords contains car" will match photos having the keyword "placard".

So as a general rule of thumb, always use the criterion "Keywords contains words a".  That will only match photos that contain "a" as a punctuation-separated "word".  E.g. "Keywords contains words car" won't match "placard".  But note that "Keywords contains words red car" would match a photo with one keyword "red flower" and another keyword "blue car".  (There are other bizarre differences between "contains" and "contains words".) 

The only way to get true exact match of keywords without using a plugin is to use the Keywords column of the Metadata browser in the Library Filter bar. That's incredibly clumsy to use when you have a large number of keywords, but there's a shortcut: In the Keyword List panel, search for the desired keyword. Then hover the mouse over the keyword and click the arrow on the right, which will open the Keywords column with that keyword selected:

wcstarksAuthor
Inspiring
June 17, 2019

Thanks

Wade Starks

wcstarksAuthor
Inspiring
June 16, 2019

Never Mind.  I finally found out how to filter on photos which include a certain keyword but not another.

Open: Filter bar

Select: Text

Select: Keywords (in this case, to search on)

I had contained as the rule, but that probably doesn't matter in this case.

Enter:  +[keyword] ![keyword]  (Assuming no spaces in the keyword, and without the brackets, of course.)

JohanElzenga
Community Expert
JohanElzengaCommunity ExpertCorrect answer
Community Expert
June 16, 2019

Create a smart collection with two criteria: keyword does contain A, keyword does not contain B.

Or, in the filter bar: keywords contain A !B. So place an exclamation point before the keyword that should not be present.

By the way: you cannot add a keywords twice, so you can probably just search on keyword A and then add keyword B, regardless of wether the image already contains B or not.

-- Johan W. Elzenga
wcstarksAuthor
Inspiring
June 16, 2019

Thanks.  I hadn't thought of using the smart collection.