Lightroom: Searching For ‘And’ or ‘Or’

category: Lightroom • 2 min read

Lightroom uses SQLite for keeping tracks of “things” in the catalog. In the Lightroom world it’s called a catalog, in the computer world it’s called a database. Databases are like Rolodex on steroids. You can ask all kind of questions, aka queries in the computer world, aka filters in the Lightroom world, like: show me all the photos that have dogs and are a family pet… or show me all the photos that I have NOT sold to customers…

The library module is “just” a front-end to ask questions about the information in the catalog.

  1. Lightroom supports AND and OR conditions in “regular” and smart filters.
  2. Lightroom supports some NOT conditions with the smart filters.

This post is about the “regular” filters

AND

  • Show me all the photos that have ALL the following keywords: Granville Island AND motorcycle

The SQL query would be:

  SELECT photos
  FROM catalog
  WHERE keywords = 'Granville Island' AND keywords = 'motorcycle';

To enable the filters, use: Menu > Library > Enable Filters or Ctrl-L/Option-L

  • In the first column, flag #1, click on the first filter, select Keyword and select your first keyword: flag #3
  • In the second column, flag #2, click on the second filter, select Keyword and select your second keyword: flag #4. You can select many more filters, by creating more columns.
  • You can see at flag #5: The total is 9 photos. There were 48 photos for the first keyword: Granville Island, but only 9 of them were of the second keyword. It’s the intersection of all the motorcycles at Granville Island, only 9 out of 15814 photographs. The AND selection is done by using a second column of the keywords.

Lightroom: Filter for AND conditions

Lightroom: Filter for AND conditions

OR

  • Show me all the photos that have ANY of following the keywords: Granville Island OR Cambie St

The SQL query would be:

  SELECT photos
  FROM catalog
  WHERE keywords = 'Granville Island' OR keywords = 'Cambie St';
  • In the first column, flag #1, click on the first filter, select Keyword and select ALL the various keywords: flag #3
  • In the second column, flag #2, click on the second filter, select None
  • You can see at flag #4: The total is 195 photos. There were 48 photos for the first keyword: Granville Island, and 147 for Cambie St, the second keyword. It’s the union of the photographs at Granville Island plus the photographs on Cambie St. The OR selection is done by using only one column and selecting all the possible keywords.

Lightroom: Filter for OR conditions

Lightroom: Filter for OR conditions