Skip to main content
danielm49702136
Known Participant
August 31, 2026
Answered

smart collections filtering by specific keyword in keyword tree

  • August 31, 2026
  • 24 replies
  • 140 views

Dear I would like to use a smart collection that depends on the keyword and I am having many problems:

  • if the keyword has many words for instance “blue birds” and there is also a keyword “birds” if I look for photos with just “birds” it also shows photos of “blue birds”
  • if I work  with keyword trees, for instance I do have “birds” and inside two other keywords “small” and “big”. Some photos do only have “birds” and other do only have “small” or “big”. If I ask the filter to show “birds” it also shows those photos with “small” or “big” keyword and that do not have the “birds”.
  • another problem with the keyword trees: supose that I add another keyword “dogs” and inside it I have “small” and “big” keywords. I did not find the the solution to make the smart collection show photos with the specific  “big” keyword inside “dogs”. I have tried “dogs > big”, “dogs / big” but didn’t work

 

I have been trying to use a synonim for each keyword with a code without spaces and asking to include the code an exclude the codes of all keyword soons. It is really a mess and if I want to add a new soon keyword, then I do need to upgrade the smart collection definition

 

Regards,
Daniel

    Correct answer johnrellis

    [View this post in your web browser. It contains formatting and images that don't appear in email.]

     

    Building on Johan’s reply: The lack of exact match for keywords in filters and smart collections is a big design botch that Adobe has never addressed.  Some options:

     

    - Use “_” rather than spaces in your keywords. (A fair number of people do that, but I don’t, since my keywords get published with my photos for others to view.)

    - You can find all photos with a specific keyword by going to the Keyword List panel, using the Filter Keywords box to quickly find the desired keyword in the list, hovering the mouse over the keyword and then clicking the right-arrow icon that magically appears to the right:

     

     

    That opens the Keyword column in Library Filter bar’s Metadata browser with that keyword selected.  

     

    You can add additional criteria to the Filter bar and then save it all as a filter preset, so you can call it up easily again (like a smart collection).

     

    - LR’s filters don’t have all of the criteria and boolean operations of smart collections. If you need that extra capability combined with exact match for keywords and other fields, see the Any Filter plugin.

    24 replies

    danielm49702136
    Known Participant
    September 6, 2026

    I have found a very ugly solution: had to program a plugin. this creates a custom metadata “keyword ids” and put inside it the list of the internal ids lightroom uses for keywords. Then filter by that id. Since the id is not visible while using, I had to make many steps:

    1. an script to show the id of a keyword (i have done it in a not nice way, I do select a photo and show all its keywords and their ids to the user -who is me while not programming)
    2. create the smart collection with a filter by that custom metadata
    3. an other script that I must run regularly that looks all photos with the keyword with that id and add that id to the custom metadata

    It works, but it is really ugly, and I do have to run step 3 every time I add or remove the intended keyword to some photo. So ugly that I guess I will not use this anymore.

     

    I had to put the id number between “_” just to make sure I am looking all the number (i.e. if the filter looks for 123 it will also show 1237, so I used _123_)

     

    johnrellis
    Legend
    September 6, 2026

    ​@drtonyb it will match “Blue Jay” if that belongs to Birds - it’s a blue bird, but how will it match “big birds” which fails to match “blue”?

     

     

    All of the filtering and smart-collection operators treat Keywords as a single set of words containing all the space-separated words from all the keywords explicitly and implicitly assigned to the photo. 

     

    In particular, the criterion Keywords Contains Words w1 w2 … wn is true if each of the words wi is a space-separated word in at least one of the explicit or implicit keywords assigned to the photo. In the example above, “blue” is a space separated word in the keyword “blue jay” and “birds” is a space-separated word in “big birds”.

     

    This is directly relevant to Daniel’s questions, e.g.

    • if I work  with keyword trees, for instance I do have “birds” and inside two other keywords “small” and “big”. Some photos do only have “birds” and other do only have “small” or “big”. If I ask the filter to show “birds” it also shows those photos with “small” or “big” keyword and that do not have the “birds”.

     

    When LR’s keywording was initially designed circa 2005-2006, tag clouds were all the rage among techies, and many web sites and apps with user-generated content were encouraging people to liberally use free-form tagging with whatever terms came to mind.  LR’s keyword search was designed with that free-form tagging in mind. 

     

    Hierarchical controlled vocabularies came later to LR, but the keyword search was not so carefully thought out, which explains why there has never been exact-match operators for keywords.

     

    Thus the longstanding workarounds suggested by Johan and me.

    Legend
    September 7, 2026

    ​@johnrellis 

     

    Keyword Tags “big birds” “blue jay” is just poor keywording in my mind.

     

    big < birds, blue jay < birds

     

    Then at least blue birds doesn’t bring up big birds that don’t contain blue.

     

    Many users don’t realise there are two operators, + and !, that can be used, although + suffers the same bug that afflicts “starts with” and “ends with”. The not operator ! does work, so

    “blue birds !big” filters any photo with “blue” and “birds”, but not with “big”.

     

    It would be helpful if the current issue was fixed and we had >, >, | operators added to the mix so that “blue < birds” or “birds > blue” or “birds | blue” match photos where “blue” has a parent keyword “birds”. We should also be able to search for blue jay exactly using quotes as in ‘blue jay’ or “blue jay“

     

    What’s the point of having a hierarchical structure if you can’t take advantage of it to search.

     

    It’s ridiculous that this issue has existed for so long, with absolutely nothing done to fix it.

    JohanElzenga
    Community Expert
    Community Expert
    September 6, 2026

    This is a classical dilemma, especially if all kinds of combinations are possible in the photos. Here’s the example I always use:

    You have three people appearing in your images; John Doe, Jane Doe and John Smith. They are friends, so all combinations exist in your photos. You have photos of John Doe on his own, John and Jane Doe together, John Smith and Jane Doe together, John Doe and John Smith together, and photos of all three of them.

    Now here’s you mission, if you choose to accept it: Create a smart collection that selects all photos of John Doe (alone or with any of the other two). Sounds simple, doesn’t it? But there’s a catch: make sure you do not get photos with just John Smith and Jane Doe together…

     

    In principle there is a solution: create a smart collection with Match All: Keywords begins with John Doe and Keywords ends with John Doe. That should work, but about two years ago it stopped working because of a bug. AFAIK, that bug still exists and so there is no solution anymore.

    -- Johan W. Elzenga
    johnrellis
    Legend
    September 6, 2026

    ​@drtonyb if you want the smart collection to show blue birds only, then you need to set the criteria for keywords matching “blue” and “birds” like this: Keywords contains all blue birds

     

    That will match a photo with the keywords “blue jay” and “big birds”. It will also match a photo with the keywords “bluebloods” and “Canadian Snowbirds”. Using “contains words” instead of “contains all” fixes the latter but not the former.

     

    johnrellis
    Legend
    September 6, 2026

    ​@drtonyb However, if you wanted all birds, but no blue birds, you would do this: Match All: Keywords contains birds, Keywords doesn’t contain blue

     

    This would incorrectly exclude a photo with the keywords “birds” and “Bluebell” (a town in Pennsylvania).

    Legend
    September 6, 2026

    ​@danielm49702136 

     

    I don’t think your questions have been answered properly yet. You asked:

    if the keyword has many words for instance “blue birds” and there is also a keyword “birds” if I look for photos with just “birds” it also shows photos of “blue birds”

     

    I am not quite clear what you want here: if you want the smart collection to show blue birds only, then you need to set the criteria for keywords matching “blue” and “birds” like this Keywords contains all blue birds

    Alternatively, you could use the Match all of the following rules in a more flexible method like this

     

    However, if you wanted all birds, but no blue birds, you would do this

     

    Next question was:

    if I work  with keyword trees, for instance I do have “birds” and inside two other keywords “small” and “big”. Some photos do only have “birds” and other do only have “small” or “big”. If I ask the filter to show “birds” it also shows those photos with “small” or “big” keyword and that do not have the “birds”.

     

    This is the same: if you want small birds only, then set Match: All with Keywords contains birds and Keywords contains small. If you want big birds only, the set Keywords contains birds and Keywords contains big, like this

     

    In the case where you want big or small birds, then you need set the smart collection like this

    You get the sub criteria by starting with only the Keywords contains birds, then press Alt on Windows or Option on Mac which changes the [+] button to [#] and clicking the [#] starts a sub criteria block.

     

    The same can be used for dogs and big, dogs and small, dogs and (big or small).

     

    johnrellis
    Legend
    September 6, 2026

    ​@drtonyb if you want small birds only, then set Match: All with Keywords contains birds and Keywords contains small.

     

    This incorrectly matches a photo with keywords “birds > big” and “dogs > small”.

    Legend
    September 6, 2026

    Not on my LrC

    Califdan2
    Inspiring
    August 31, 2026

    ​@johnrellis said:  - Use “_” rather than spaces in your keywords. (A fair number of people do that, but I don’t, since my keywords get published with my photos for others to view.)

    Personally, I use “-” instead of “_”.  But when I do so,  I uncheck the “Export this keyword” box and put in the same words with spaces as a synonym and check the box to export the synonym

     

    Pertaining to using a Metadata filter,  If you are on Windows, there is a limit on the number of entries that it can show in a single list (the limit is acutally a pixel limit but has the same affect).  So, if you have a long list of keywords the pull down may only show the first bunch of them.  Having KW’s in a hierarchy and setting the filter to show them as a hierarcy and then only expanding the branches you need usually is sufficient to get around this.   In my case, when viewing as a flat list, it only gets down to “Forest” before hitting the limit.    

    JohanElzenga
    Community Expert
    Community Expert
    September 6, 2026

    Why not the opposite? Use spaces in the (exporting) keywords, and (non exporting) synonyms with dashes or underscores.

    -- Johan W. Elzenga
    Califdan2
    Inspiring
    September 6, 2026

    Good Question.   

     

    When I first came up with scheme (maybe around LR/4 or 5) Filters and Smart Collections ignored Synonyms so to get the benefit, the version with the dash or underscore needed to be the actual KW. 

    After reading your question, I re-tested it and to my great surprise, somewhere along the road Filters and Smart Collecitons have started looking at Synonyms as well.  So, you are correct that it can be the other way around.

    Now I have to decide whether or not go go back and change the thousands of my KW’s with dashes to be the other way around.   Hmmmmm.  Nope not worth the effort.

    danielm49702136
    Known Participant
    August 31, 2026

    It is very strange tha there are so many problems with lightroom that seem very simple to correct and they are still there for years and years. I wont be able to make a smart collection with simple rules with Ligthroom capabilites. Any filter plugin is excellent and does much more than what I do need. 

    dj_paige
    Legend
    August 31, 2026

    Not exactly what you asked for, but a possible approach is to go to the Keyword List panel, then find “blue birds” and hover your mouse over it until an arrow appears at the right side of the Keyword List Panel on that row, click on the arrow. This will give you all of your photos with the “blue birds” keyword. (Oops looks like ​@johnrellis has beaten me to it)

    Not a smart collection, but these are the photos you want.

    By the way, isn’t bluebird one word? That would solve some of your problems.

    Also, if “blue birds” are a keyword under “birds”, get creative and instead of “Birds” use “Aves”.

    johnrellis
    johnrellisCorrect answer
    Legend
    August 31, 2026

    [View this post in your web browser. It contains formatting and images that don't appear in email.]

     

    Building on Johan’s reply: The lack of exact match for keywords in filters and smart collections is a big design botch that Adobe has never addressed.  Some options:

     

    - Use “_” rather than spaces in your keywords. (A fair number of people do that, but I don’t, since my keywords get published with my photos for others to view.)

    - You can find all photos with a specific keyword by going to the Keyword List panel, using the Filter Keywords box to quickly find the desired keyword in the list, hovering the mouse over the keyword and then clicking the right-arrow icon that magically appears to the right:

     

     

    That opens the Keyword column in Library Filter bar’s Metadata browser with that keyword selected.  

     

    You can add additional criteria to the Filter bar and then save it all as a filter preset, so you can call it up easily again (like a smart collection).

     

    - LR’s filters don’t have all of the criteria and boolean operations of smart collections. If you need that extra capability combined with exact match for keywords and other fields, see the Any Filter plugin.

    JohanElzenga
    Community Expert
    Community Expert
    August 31, 2026

    I’m afraid there is not much you can do about this. Lightroom Classic does not work with keyword phrases, so a keyword “blue bird” is handled as if it’s two keywords, ‘blue’ and ‘bird’. That makes it extra difficult if you use the same words (big, small) in more than one hierarchy. And to make it worse, there is a bug where ‘begins with’ and ‘ends with’ does not work correctly in smart collections. Using ‘begins with birds’ and ‘ends with birds’ as criteria would normally make it possible to select images with only ‘birds’ as keyword, and not get ‘blue birds’, but that no longer works.

    -- Johan W. Elzenga