# Advanced keyword filtering?



## thany (Oct 31, 2013)

I'm looking for a more advanced filter for keywords. Currently, it seems, the only way to filter by keywords is by OR'ing them together, so to speak.

I have had some use-cases, which I already worked around, where I needed to show only the pictures that _don't_ contain a certain keyword (a NOT filter). The intuitive thing to do is to select all other keywords, which (now obvious to me) doesn't do what I want. I've also come across a scenario where I needed to only show pictures that contain both the two selected keywords, but not one of either (an AND filter instead of OR).

Is this possible? Or should I be approaching such scenarios differently?


----------



## clee01l (Oct 31, 2013)

Instead of the filter bar, you might consider Smart collections to achieve the same purpose.  Each can be AND/OR'd is separate criteria. Very complex queries can be generated in this way.  Also consider the verb choices "Contains", Does not Contain" and "Contains All" .  By placing the "!" in front of a keyword is the same as interjecting "NOT" in front of the keyword As in a keyword phrase {bird dog !cat} returning any, birds with or without  dogs but not any birds or dogs with the keyword cats present.


----------



## thany (Oct 31, 2013)

Never used Smart Collections actually (is that bad?) but now that I'm looking at how to create them, their filtering mechanism is certainly more powerful than the regular metadata filters.

It's a nice idea certainly. But just one thing: I need it to work on a certain folder (and possibly subfolders), not on my entire catalog. As they are now, I'm really missing my folder structure that I'm used to.
Now of course, I could set a certain folder in the Smart collection (and why it's not possible to *select* a folder... Boy, who knows). Sure, that does work. But it feels too "permanent", as I'll only need these collections to quickly filter out certain pictures from a folder that I happen to be working in. Is it possible to apply a smart collection to "the folder I'm currently viewing", so to speak?


----------



## LouieSherwin (Oct 31, 2013)

Hi, 

Another method that is more Ad hoc than setting up smart filters is to try the Any Filter plug-in by John R. Ellis. It's a bit quirky but he gives you access to search anything that is in the catalog or in the image files. 

-louie


----------



## clee01l (Nov 1, 2013)

In Smart Collections  Under "Source", "Folder" is one of the criteria choices.  So you should be able to construct the precise query that you need with smart collections.


----------



## thany (Nov 1, 2013)

clee01l said:


> In Smart Collections  Under "Source", "Folder" is one of the criteria choices.  So you should be able to construct the precise query that you need with smart collections.


Yes, I know. First of all, what do I type there? The whole path to a folder? In a "folder" filter, I'd expect to be able to select one or more folders. Treating it like a free text field seems silly to me (lazy even).
Secondly, how do I make it apply to the *current* folder, whichever that is?


LouieSherwin said:


> Another method that is more Ad hoc than setting up smart filters is to try the Any Filter plug-in by John R. Ellis. It's a bit quirky but he gives you access to search anything that is in the catalog or in the image files.


Thanks, I'll see if that'll fit my needs.


----------



## clee01l (Nov 1, 2013)

You construct the query for a specific folder by searching for something unique in that folder name If there is nothing that uniquely defines one folder, then combine that with other criteria to retreive only images from that one folder. e.g:
{folder}{contains}{Zion}
or
{folder}{contains}{10-31}
{keyword}{contains}{Zion}

Since I use a date named folder scheme, the latter would work for me for images that I shot yesterday.


----------



## erro (Nov 1, 2013)

It's a shame there is no easy way to make "intersected" searches/filters in LR.

I would like to be able to select a folder, and then "add" an existing smart collection rule to that folder, perhaps by Ctrl-clicking or something. And then perhaps add a third intersecting filter by Ctrl-clicking a keyword. Or something like that.


----------



## Selwin (Nov 2, 2013)

Hi Robert,
The problem is that LR won't allow existing Smart Collections as a criterium, only existing "dumb" collections. You can of course create nested conditions by holding down the Option (Mac) or Control (Win) key when clicking the + sign inside the Edit Smart Collection dialog. They can be set as intersection, just like the Smart Collection itself.


----------



## Victoria Bampton (Nov 2, 2013)

thany said:


> But just one thing: I need it to work on a certain folder (and possibly subfolders), not on my entire catalog. As they are now, I'm really missing my folder structure that I'm used to.



You can use Clee's  {bird dog !cat} phrase in the Text Filter bar, as well as in smart Collections. Text filters would be confined to your current folder view by default.


----------



## Selwin (Nov 2, 2013)

thany said:


> Never used Smart Collections actually (is that bad?) [...] Sure, that does work. But it feels too "permanent", as I'll only need these collections to quickly filter out certain pictures from a folder that I happen to be working in. Is it possible to apply a smart collection to "the folder I'm currently viewing", so to speak?


Hi thany,
Member johnbeardy has a solution that may work for you:
- First you create a collection (not a smart collection!) called "current work" or however you wish to call it. 
- Then when you start working on a new set of images, you simply drag all of these images to this collection. 
- From now on, your images are in a collection that can be referenced from within a smart collection. In the smart collection rules, you can simply select "Source" -> "Collection", "contains" and then "current work". You can make it rock solid by making the folder name more unique (like adding periods or numbers like John did).
- You can build numerous smart collections upon this current work collection. 
- All you need to do when finished is remove all images from your current work collection to make room for a new series.


----------



## erro (Nov 2, 2013)

Selwin said:


> Hi Robert,
> The problem is that LR won't allow existing Smart Collections as a criterium, only existing "dumb" collections. You can of course create nested conditions by holding down the Option (Mac) or Control (Win) key when clicking the + sign inside the Edit Smart Collection dialog. They can be set as intersection, just like the Smart Collection itself.



I know. I'm not talking about criterias inside smart collections. I would like to combine a selected folder in the folder panel, with a smart collection from the collection panel, with a keyword from the keyword panel and so on.

As it is today, if I select a folder in the folder panel, I will see all photos in that folder. If I then click on a smart collection, I will "loose" the folder view and instead see the contents of the smart collection. Or if I click a keyword in the keyword panel I will see all photos in my entire catalog that contain that keyword. I would like to be able to combine these things in a simple way.


----------



## Selwin (Nov 2, 2013)

Yes, I understood what you wanted to do. And as much as I would like to have such functionalities, at the same time I know there is nothing in my current work flow that I can't achieve with the current smart collections. Maybe we can issue a functionality request at Adobe...


----------



## clee01l (Nov 2, 2013)

erro said:


> I know. I'm not talking about criterias inside smart collections. I would like to combine a selected folder in the folder panel, with a smart collection from the collection panel, with a keyword from the keyword panel and so on...


 A Smart collection resolves into a SQL query (a programming language used for retreiving information from a database)  What you are asking for is to apply one criteria  (select a folder) followed by more criteria (Select some more stuff) followed by another criteria (Select images with a keyword)
The end result is another more complex query.  All of which is a Smart Collection which you can construct as quickly using the Smart Collection editor   The statement "SELECT an image WHERE  the folder is "X" and the keyword is "Y" and the other attributes (that whole bunch of other stuff) are "Z"  Is a pseudo language statement of your query.  Ultimately LR needs to turn that into a valid SQL statement so that the result can be retrieved from the database.


----------



## erro (Nov 2, 2013)

Yes Clee, I understand that. But constructing a new smart collection for every search you may want to do is not neccessarily easy or quick. It would be much easier and quicker to be able to combine the various search/filter options already available on screen by just "combine-clicking" in some way. I mean, the various panels are already there, ready for clicking. But maybe it's just me who see the benefit.


----------



## Selwin (Nov 2, 2013)

No Robert, I can see how your idea could be really powerful. It reminds me of computer programming I did over 30 years ago, where I would create a number of simple procedures that in turn I could call from other higher level procedures. It's about reusing more or less simple elements into more complex structures.

Still this is mainly about code redundancy and not about added functionality, because you won't be able to create Smart Collections that you can't create now. If I understood you correctly, that is.


----------



## johnbeardy (Nov 2, 2013)

At one point, you could do something like Ctrl Click a folder and a smart collection, and the latter's criteria would be applied. It was flaky, and I'm pretty sure it was a bug that was fixed. It was also horribly geeky and there's a better equivalent in Aperture where you can drag a smart album under a folder.


----------



## thany (Nov 7, 2013)

Selwin said:


> Hi Robert,
> The problem is that LR won't allow existing Smart Collections as a criterium, only existing "dumb" collections. You can of course create nested conditions by holding down the Option (Mac) or Control (Win) key when clicking the + sign inside the Edit Smart Collection dialog. They can be set as intersection, just like the Smart Collection itself.


Hold on, that sounds new to me. Does that mean combining OR and AND filters within a smart collection? Because that would actually cover my needs.
So something like this:

( keywords are empty OR caption is empty OR not geotagged ) AND flag is pick AND folder is something

Are you saying that's possible?


----------



## Jim Wilde (Nov 7, 2013)

Yes, but you'd probably need to construct it the other way round, i.e.

Pick Flag is Flagged AND Folder contains FolderName AND (Keywords are Empty OR Caption is Empty OR GPS Data is No Coordinates)

Something like this:



Would return all picked images in folder xyx that don't contain either keywords, caption, or GPS data.


----------



## Selwin (Nov 7, 2013)

Hi thany,

Yes, Jim's example shows exactly what you want. You can also filter on collections, but not on smart collections.


----------



## thany (Nov 8, 2013)

Not bad. I tried it, and it works very nicely.

I'm still struggling with one more thing. I can't work out how to make a filter for keywords to contain *only* a certain tag. Sure I could make a filter for not containing all the others, but this is fiddle and hard to maintain. Any better solutions?

I now want a smart collection that says "either no keywords at all, or only machine-keywords". I can't work out how to do that. (machine keywords are those with a colon in them)


----------



## Selwin (Nov 8, 2013)

Just to be sure, what do you mean by "machine keywords"? Can you give an example?


----------



## erro (Nov 8, 2013)

Keywords contain :

Don't know if that works.

Another method might be to place all "machine-keywords" under a parent keyword. That way you can search for the parent keyword (or the lack of it).


----------



## Selwin (Nov 8, 2013)

Hi Erro,

Never heard of machine keywords that contain ":". But I'm very interested! Nothing comes up on Google. Could you please elaborate, tell me more?


----------



## Linwood Ferguson (Nov 8, 2013)

Way back up to the top question and to state something you may already know (if so apologies), while filtering on two keywords is an OR, you can put "Keyword" type in two (or more) columns on the metadata filter, then select a keyword in each, and it's an AND.


----------



## thany (Oct 31, 2013)

I'm looking for a more advanced filter for keywords. Currently, it seems, the only way to filter by keywords is by OR'ing them together, so to speak.

I have had some use-cases, which I already worked around, where I needed to show only the pictures that _don't_ contain a certain keyword (a NOT filter). The intuitive thing to do is to select all other keywords, which (now obvious to me) doesn't do what I want. I've also come across a scenario where I needed to only show pictures that contain both the two selected keywords, but not one of either (an AND filter instead of OR).

Is this possible? Or should I be approaching such scenarios differently?


----------



## erro (Nov 8, 2013)

Selwin said:


> Hi Erro,
> 
> Never heard of machine keywords that contain ":". But I'm very interested! Nothing comes up on Google. Could you please elaborate, tell me more?



Well, I don't even know what a "machine keyword" is.....


----------



## Selwin (Nov 8, 2013)

According to thany, "machine-keywords" are keywords with a : in them (see post #21 above). Maybe his description is a bit off. So let me rephrase my question:

Is a LR keyword that contains a : a special class of keywords? If so, what are they called and what added functionality do they offer?


----------



## clee01l (Nov 8, 2013)

Selwin said:


> According to thany, "machine-keywords" are keywords with a : in them (see post #21 above). Maybe his description is a bit off. So let me rephrase my question:
> 
> Is a LR keyword that contains a : a special class of keywords? If so, what are they called and what added functionality do they offer?


 Quite possibly the OP has created "Machine-Keywords" as user defined not for export keywords.  Similarly, I use the "@" as the initial character for my user defined not for export keywords.


----------



## thany (Nov 10, 2013)

But checking for keywords to contain *only* a certain (set of) keyword(s) is possible too? And if so, how?
Oh wait, huh? What? I replied to a different set of posts... Wehn I replied, there where different posts above this than when the reply had come through? Whuuu?

 Anyway, machine keywords are ones with a colon in them. Nothing too special really. I saw the term... somewhere. I looked up what it was, and hey presto, machine keywords (or tags?) are used for tagging pictures with data that a human user doesn't need to see. But they may still proove to be useful in searches and such.

I'm using only these atm:
export:normal
export:mini
But I'm sure I'll come up with more in the future.


----------



## erro (Nov 10, 2013)

In short: LR doesn't have different kind of keywords. A keyword is  keyword. If you have a system where keywords with a colon has a special meaning for you, then it is a system for you. LR doesn't handle colon-keywords in any special way.

I (like someone else) have keywords that start with the @-sign, indicating that it is a parent keyword. But that is only for my own use. LR doesn't treat those keywords in any other way than it does other keywords.


----------



## Selwin (Nov 10, 2013)

Hi Erro, thank you for clearing that up, my hunch was right. I had never heard of them either. 
thany: if this way of using keywords works for you, then that is fine. If you have any trouble searching for these keywords I'm happy to assist


----------



## erro (Nov 10, 2013)

thany said:


> But checking for keywords to contain *only* a certain (set of) keyword(s) is possible too? And if so, how?
> Oh wait, huh? What? I replied to a different set of posts... Wehn I replied, there where different posts above this than when the reply had come through? Whuuu?
> 
> Anyway, machine keywords are ones with a colon in them. Nothing too special really. I saw the term... somewhere. I looked up what it was, and hey presto, machine keywords (or tags?) are used for tagging pictures with data that a human user doesn't need to see. But they may still proove to be useful in searches and such.
> ...



If I understand you correctly, I use keywords in a similar way, but I use hierarchies instead:

- export
- - normal
- - mini

Assigning the keyword "mini" will also implicitly make the photo inherit the keyword "export"


----------

