Spotlight is a powerful macOS search technology that makes searching for files easy. Using Spotlight, you can search for things using attributes such as the width and height of an image in pixels, or its exposure time. Information like this (called metadata) is embedded in a file by the application that created it. Spotlight’s power comes from being able to extract, store, update, and organize the metadata of files to allow fast, comprehensive searches.

Spotlight uses Quick Look technology to display thumbnails and full-size previews of the documents returned in a search. As is the case with Quick Look, although macOS supports many types of images, the formats typically used for astronomy are not. Observatory therefore also provides Spotlight importers for the following image formats:

These Spotlight importers ensure that you can search for astronomical images using the following attributes in the Finder:

The attribute names were chosen to match those of image formats natively supported by macOS, when applicable, so there’s no need need for separate searches for, say, DNG files and FITS files.

Some of this extracted metadata is displayed in the More Info section of the Finder’s Get Info window, which is displayed if you select an image and choose File ▸ Get Info (⌘I). The preview is generated by the Quick Look generator.

Finder: Get Info
Finder: Get Info

Searching with Spotlight

To invoke Spotlight, you would usually press ⌘spacebar or click the magnifying glass icon at the right of your menubar. Much more advanced searches can be performed by searching in the Finder. Open a Finder window and click in the search field at the top, or press ⌘F to open a new search window or convert an open Finder window into a search window.

If the Finder displays your search results in Icon view, you’ll probably want to switch to List view to get a better look at your results. You can then select the column headers to sort the results. If you want more column headers to be visible, press ⌘J and check other columns from the View Options window, or use the contextual menu of the column header (Control-click).

macOS Finder has an undocumented but very useful feature: If you move the folder containing your astronomical images into the Pictures folder, the contextual menu of the List view’s column header will also contain a Dimensions item. Select it, and a Dimensions column will be added to the folder’s Finder window. The information displayed is obtained from the Spotlight index, and because Observatory contains Spotlight importers for FITS, SBIG and XISF images, the Finder will now display the width and height in pixels for these files.

Another useful feature is that when you switch to Icon view and press ⌘J, by selecting Show item info in the View Options window, the image dimensions will be displayed below the image thumbnails.

The Finder window’s search bar contains several options for tailoring your results. When you start typing search terms, the Finder pops up a menu asking if you want to restrict your search terms to file names only. And you can click on This Mac to change the target of your search from the folder you were in when you started searching, to your entire Mac.

Finder: Search
Finder: Search

Adding criteria

To narrow down your results, start by selecting one of the criteria in the first menu. The default items in the menu are not very good choices for searching FITS, SBIG and XISF images, so click Other… here. Observatory’s Spotlight importer adds many attributes to the list. Click on the In Menu check box next to an item if you want it to appear in the search bar menus for easy access in the future.

Finder: Search Attributes
Finder: Search Attributes

Useful additions to the menu might be:

Finder: Right Ascension Search Attribute
Finder: Right Ascension Search Attribute

Combining multiple queries

Often a search requires more than one set of criteria to reduce the number results to just those you are interested in. Finder window searches let you specify as many parameters as you want. Say you want to search for all light exposures of 1800 seconds taken through an OIII filter. To do this, you could select Filter name in the the first menu and have it match “OIII”. Click on the + button in the search bar to add another search parameter, set it to Image type and enter “light”. Then add another with the + button, select Exposure time and enter “1800”. Spotlight will display all images matching these criteria.

Finder: Combining Search Queries
Finder: Combining Search Queries

You can also change the operators of your criteria, e.g. is greater than instead of equals. This way, by combining criteria, you can even search for all images within a range of Right Ascension and Declination values.

You can use quotes to specify that a search should look at the exact phrase you type. You can also use Boolean search terms, to exclude criteria or to create an OR search. Once you have one condition set up, you can add a Boolean term to your next condition by Option-clicking the + button. The + will turn into an ellipsis (), and you’ll get a new pull-down menu with options for Any (OR), All (AND), or None (NOT).

Saving searches for later

To save your search as a Smart Folder, click on the Save button in the search bar and enter a name for the Smart Folder. Enable the Add To Sidebar option if you want add the Smart Folder to the sidebar of your Finder window. Whenever you open this Smart Folder, Spotlight will run the search again and update the results with all files that fit the criteria.

You can change the search by opening the Smart Folder, clicking the action button, and selecting Show Search Criteria.

Spotlight indexing should be enabled for the drive your images reside on. To check the Spotlight indexing status of a drive, open Terminal (in /Applications/Utilities), and enter

mdutil -s <path to volume>

For example,

mdutil -s "/Volumes/Macintosh HD"

It should return Indexing enabled. If you have your images on an external drive or NAS, then it may report Indexing and searching disabled. You can enable it with the same command (enter mdutil for the available options).