Lesson 16

Use Metadata, Spotlight, and Siri

Metadata is information used to describe content. The most basic forms of file and folder metadata are names, paths, modification dates, and permissions. Metadata isn’t part of an item’s content; rather, it describes an item in the file system.

In this lesson you learn how macOS uses file metadata and how this metadata is stored in file systems. You learn how to take advantage of metadata by using the file-system tags feature. And you learn how to use Siri and Spotlight to search.

Reference 16.1 File-System Metadata

Forked file systems, such as Apple File System and Mac OS Extended, enable data to appear as a single item in the file system. A file appears as a single item but is composed of two pieces: a data fork and a resource fork. This technology enables macOS to support file type identification in the data fork, whereas the extra information specific to macOS resides in the resource fork.

Some third-party file systems, like FAT, don’t know how to store this additional data. The solution to this problem is addressed with the AppleDouble file format, covered later in this lesson.

File Flags and Extended Attributes

macOS also uses metadata in the form of file-system flags and extended attributes to implement system features. Examples of file-system flags include the hidden flag, covered in Lesson 14, “Use Hidden Items, Shortcuts, and File Archives,” and the locked flag, covered in Lesson 19, “Manage Documents.”

Any process or app can add an arbitrary number of custom attributes to a file or folder. This enables developers to create new forms of metadata without having to modify the existing file system.

File-System Tags

Assign file-system tags to your files, and then use those tags to search for or organize your files. File-system tags are stored as extended attributes. macOS uses extended attributes for several file features, including the Stationery Pad option, Hide Extension option, and comments. You can access these items from the Info window in the Finder. The following Info window screenshot shows a document featuring Red and Whitepaper file-system tags and a searchable text comment.

Image

You can assign multiple tags with custom user-defined tag colors and tag names. You can modify tags for documents in any app that presents a Save dialog. When you select tags for a document, you can create a new tag by typing a new name in the Tags field.

You can customize tags in the Tags pane of the Finder preferences by choosing Finder > Preferences or by pressing Command-Comma. From the Tags pane, you can create additional tags by clicking the Add (+) button, and you can remove existing tags by clicking the Remove (–) button. To rename a tag, click the tag name, and to change the color, click the tag color. You can also define which tags are shown in the Finder sidebar by selecting the tag checkbox, and you can set the tag order by dragging tag entries in the list. Below the tags sidebar list, you can define favorite tags so that they will appear in the Finder menus.

Image

As mentioned in Reference 1.2, “What’s New in macOS Mojave,” Stacks is a new feature in macOS Mojave that enables you to organize your desktop by automatically organizing your files into related groups. In the Finder, from the View menu, choose Use Stacks, or just Control-click anywhere in the Desktop and choose Use Stacks.

By default, macOS Mojave organizes stacks by kind. Here’s an example of some files organized in stacks by kind.

Image

macOS Mojave uses metadata to enable you to group your stacks by the following:

Image Kind

Image Date Last Opened

Image Date Added

Image Date Modified

Image Tags

Here’s an example of a desktop with stacks grouped by tags.

Image

When stacks are organized by tag, files that don’t have a tag get their own stack: “No Tags.” A stack looks like a stack of files. You can place your pointer over a stack, then use two fingers on a trackpad or one finger on a Multi-Touch mouse to scroll through the contents. Click a stack to see its contents. You can have multiple stacks expanded at the same time. If you sort stacks by tags, each file that has multiple tags will appear in multiple stacks.

In macOS Mojave you can edit a file’s tags in the Preview field when you view items in the Finder in columns or as a gallery. The following figure also illustrates that you can use quick actions for this image (Rotate Left, Markup, and More) while viewing images as a gallery.

Image

macOS enables you to search for or organize your items by tag. In the Finder, you can find tags with Spotlight or in the sidebar. Using Spotlight is detailed later in this lesson.

Image

AppleDouble File Format

File-system metadata compatibility with third-party file systems might be an issue. Only volumes formatted with the APFS or Mac OS Extended file system fully support resource forks, data forks, file flags, and extended attributes. Third-party software exists for Windows operating systems to enable them to access the extended metadata features of APFS and Mac OS Extended. More often, though, users take advantage of the compatibility software built into macOS to help other file systems work with these metadata items.

For almost anything other than APFS or Mac OS Extended volumes, including FAT volumes, older Xsan volumes, and older NFS shares, macOS stores metadata from the file system in a separate hidden data file. The data retains the original name, but the metadata is saved with a period and underscore (._) before the original name. This file is sometimes referred to as a dot-underscore file. This technique is called AppleDouble.

For example, if you copy a file that contains metadata and is named My Document.docx to a FAT32 volume, macOS automatically splits the file and writes it as two discrete pieces on the FAT32 volume. The file’s internal data is written with the same name as the original, but the metadata is written to a file named ._My Document.docx, which remains hidden from the Finder. This works out well for most files, because Windows apps only use the contents of the data fork. But if you use Windows to edit and save a file like this to a FAT32 volume, the resource fork will not be preserved, so if you later open the file on your Mac, information might be missing. And if users on other operating systems display hidden files, they will see the dot-underscore files if they exist.

Image

Windows systems default to automatically hiding dot-underscore files. In fact, to acquire the Windows screenshot shown here, we had to manually enable Hidden Items. macOS includes a method for handling metadata on SMB network shares from NTFS volumes that doesn’t require the AppleDouble format. The native file system for current Windows-based computers, NTFS, supports something similar to file forking, known as alternative data streams. The file system writes the metadata to the alternative data stream, so the file appears as a single item on both Windows and macOS.

Reference 16.2 Spotlight and Siri

For any query, Spotlight and Siri can go beyond file-system searches and find relevant information from inside local documents, app function results, and Internet sources. The Spotlight icon is in the upper-right corner of the screen. If you enabled Siri, the Siri icon is between the Spotlight icon and the Notification Center icon.

Image

Search with Spotlight

Spotlight combines the search results list and search results preview into a Spotlight window that appears on top of your other open windows. You can initiate a Spotlight search by clicking the Spotlight (magnifying glass) icon at the upper-right corner of the screen or by using the default Spotlight keyboard shortcut: Command-Space bar.

Spotlight search is so fast that the results change in real time as you type in your search query. The left side of the Spotlight window is a list of the search results; the right side is a preview area. Use the Up Arrow and Down Arrow keys keys to navigate the results list, or select an item (by clicking once) to show a preview. Both the results list and preview area are scrollable to reveal more content. You can scroll to the bottom of the Spotlight window, select “Show all in Finder,” and then press Return to open a new Finder window with your search terms automatically entered in the Search field. Select an item, then press the Command key to display the full path of the item at the bottom of the Spotlight window. Double-click an item, or select an item and then press Return, to open the selected item immediately.

Search with Siri

With Siri you can speak plain-language requests and macOS returns the results, often both in spoken word and as a visual representation. You can initiate a Siri request by clicking the Siri icon (to the right of the Spotlight icon) at the upper-right corner of the screen or by using the default Siri keyboard shortcut: press and hold Command-Space bar until the Siri window appears.

Image

As you speak, Siri will translate your words to text and, more importantly, interpret your meaning. As you can see in the preceding screenshot, Siri interpreted “Did I download any PDFs today” to mean “PDFs that were modified today in your Downloads folder” and returned a Finder search.

When you make a request with Siri, your Mac will send the translated text to Apple servers to interpret the meaning of your words. In a local file search, Siri leverages Spotlight to provide the file list results.

Double-clicking any item in the Siri search results will open that item in an appropriate app. You can also save the results of a Siri search by clicking the Add (+) button at the top right of the Siri search results. This will create a Notification Center widget that can be accessed by clicking the Notification Center icon, which is the farthest-right icon in the menu bar.

Image

If you ask Siri to find a password, Siri opens Safari and then opens the Passwords pane in Safari preferences.

More Info Image

This guide primarily focuses on using Siri to search for local items, but Siri is capable of much more, like helping you find your iPhone. You can find out what else you can ask by opening Siri, not asking anything, and waiting a few moments. You can also check out Apple Support article HT206993, “How to use Siri on your Mac.”

Search with Hey Siri

Hey Siri enables you to access Siri hands-free. Just say “Hey Siri,” then make your request. The following Mac computers support Hey Siri:

Image MacBook Pro (15-inch, 2018)

Image MacBook Pro (13-inch, 2018, Four Thunderbolt 3 ports)

Image MacBook Air (Retina, 13-inch, 2018)

Image iMac Pro

Hey Siri can also access HomeKit and control your HomeKit-compatible devices.

For more information about devices that support Hey Siri, read Apple Support article HT209014, “Devices that support ‘Hey Siri.’”

About Search Results

The following figure shows the results of a Spotlight search for “secure enclave.”

Image

The results list contains results from Internet sources, notes from Notes, documents, and even messages from Mail and Messages. Spotlight can also search inside app data sources. In the preceding Spotlight search result, the selected item being previewed is a PDF document. Note the Preview app icon in the upper-right corner of the Spotlight search window. Neither the document’s name nor the previewed cover page contains the words “secure enclave.” Instead, Spotlight searched inside the text of the PDF file for the words “secure enclave.”

Spotlight and Siri can also take advantage of an app’s functions. For example, Spotlight and Siri can perform mathematical calculations and unit conversions (including market-based currency conversion) by integration with Calculator.

The metadata technologies covered previously in this lesson are also searchable with Spotlight and Siri, including filenames, file flags, modification dates, and file-system tags. Additionally, many files contain internal metadata used to describe the file’s content. For example, many photo files contain additional camera setting information embedded as metadata inside the file. Spotlight and Siri can search through this document-specific metadata information as well.

In addition to local files, Spotlight (and by proxy Siri) can search through the contents of shared files from other Mac clients, Time Machine backups, and iCloud Drive.

Extending beyond local network services, Spotlight and Siri can search a variety of Internet sources through Apple services known as Spotlight Suggestions and Siri Suggestions. These Apple-hosted services use a combination of search history, location information, and user information to generate relevant search results from a wide variety of Internet sources. An Internet connection is required to take advantage of Spotlight Suggestions and Siri Suggestions.

Spotlight Indexing

Spotlight (and by proxy Siri) is able to perform wide and deep searches of local items and shared files quickly because it works in the background to maintain highly optimized databases of indexed metadata for each attached local volume. When you first set up macOS, it creates these databases by indexing all the available local volumes. macOS also indexes new volumes when they are first attached.

A background process automatically updates the index databases on the fly as changes are made throughout the file system. As these indexes are kept current, Spotlight needs to search only the databases to return thorough results. Spotlight preemptively searches everything for you in the background, so you don’t have to wait for the results when you need them.

Spotlight directly indexes Time Machine and AirDisk volumes (disks shared with AirPort Extreme), but it doesn’t index shared volumes from other computers. Spotlight can connect to indexes on shares hosted from other Mac operating systems.

You can find the Spotlight general index databases at the root level of every volume in a folder named .Spotlight-V100. A few apps maintain their own databases separate from these general index databases. One example is Mail, which maintains its own optimized email database in each user’s folder at ~/Library/Mail/V6/MailData/Envelope Index.

If you are experiencing problems with local file searching, you can force Spotlight to rebuild the index databases by deleting them and restarting your Mac or by managing the Spotlight preferences, as covered later in this lesson.

Spotlight Plug-ins

Spotlight can create indexes, and search—from an ever-growing variety of local metadata—using plug-in technologies. Each Spotlight plug-in examines specific types of files or databases. Many Spotlight plug-ins are included by default, but Apple and third-party developers can create additional plug-ins to expand Spotlight search capabilities.

Included Spotlight plug-ins enable you to:

Image Search with basic file metadata, including name, file size, creation date, and modification date

Image Search with media-specific metadata from picture, music, and video files, including timecode, creator information, and hardware capture information

Image Search through the contents of a variety of file types, including text files; app databases; audio and video files; Photoshop files; PDF files; Pages, Numbers, and Keynote files; and Microsoft Office files

Image Search through personal information like the contents in Contacts and Calendar

Image Search for correspondence information like the contents of Mail messages and Messages chat transcripts

Image Search for relevant information like your favorites or web browser bookmarks and history

Image Perform Internet searches using Google or Apple Spotlight Suggestions

Spotlight plug-ins are stored in various Library folders. The Apple built-in Spotlight plug-ins can be found in both /System/Library/Spotlight and /Library/Spotlight. Third-party plug-ins should always be installed in either /Library/Spotlight or ~/Library/Spotlight, depending on who needs access to them.

You can create custom metadata for Spotlight by entering Spotlight comments in the Info and Inspector windows from the Finder.

Search Security

To provide security on par with the rest of the file system, Spotlight indexes every item’s permissions. Even though Spotlight indexes every item on a volume, it automatically filters search results to show only items that the current user has permissions to access. For example, you can’t search the content of another user’s Documents folder. All users can search through locally attached nonsystem volumes, including mounted disk images, even if another user attached the device.

Spotlight Suggestions and Siri take advantage of many Apple services and Internet sources, but they always adhere to the Apple Privacy Policy. Apple takes user privacy very seriously and always attempts to keep a user’s information as safe as possible while still providing advanced services. You can disable searches that require Internet services in the Spotlight preferences and Siri preferences, as covered later in this lesson.

For more information about Apple’s Privacy Policy, see www.apple.com/privacy/.

Perform an Advanced Spotlight Search

The default Spotlight search provides quick search results, but as you’ve learned in this lesson, Spotlight has a powerful range of search features.

You can use the Finder to perform an advanced file-system search with any of the following methods:

Image At the bottom of a Spotlight search list, double-click “Show all in Finder.”

Image In the Finder, choose File > Find (or press Command-F).

Image In a Finder window, enter a word or phrase in the Search field (in the upper-right corner).

You can select an item next to the word Search under the toolbar to limit the scope of the search.

Image

Enter a word or phrase in the Search field in the upper-right corner. A menu appears with suggestions for search types, based on what you’ve entered. You can choose something from the menu or just press Return to include anything related to your search term.

Image

You can select an item from the search results to display the path to the selected item at the bottom of the Finder window.

Image

You can select an item and then press the Space bar to open a preview of the selected item.

Refine your Spotlight search from the results in a Finder window by clicking the small Add (+) button below the Search field; this allows you to add as many search attributes as you need. After you add a new search attribute, click the first word in the search attribute to choose another type from the menu.

Image

If you don’t see the search attribute you’re looking for, you can add other attributes that aren’t enabled by default. To add search attributes, select any attribute and choose Other from the menu. In the dialog that appears, you can add search attributes to the menu. Two especially useful search attributes for administrators are “File visibility” and “System files,” neither of which is shown by default in any Spotlight search.

Image

Tip

Take some time to explore the additional search attributes. Search attributes include specifying audio file tags, digital camera metadata, authorship information, contact information, and many other metadata types.

You can click the Save button on the right to save your search criteria as a Smart Folder.

Image

You can remove the suggested name for the Smart Folder, enter a descriptive name, and then click Save. By default, the option to add the Smart Folder to the Finder sidebar is enabled.

Image

Smart Folders are like normal folders in that they can be given a unique name and placed anywhere you like, including the Finder sidebar. Smart Folders are special because their contents always match your search criteria no matter how the file system changes. The Recents and Tags items in the Finder sidebar are predefined Smart Folders.

Image

Manage Spotlight Preferences

From Spotlight preferences, any user can choose to disable specific categories so they do not appear in Spotlight searches. For example, users can choose to disable Spotlight Suggestions if they don’t want any search information sent over the Internet. You can also prevent some volumes from being indexed by specifying those volumes in the privacy list. However, by default, all new volumes are automatically indexed, so users must manually configure Spotlight to ignore a volume.

The Spotlight privacy list is a system-wide setting that remains the same across all user accounts, but users can change the privacy list.

Opening Spotlight preferences defaults to the Search Results tab, where you can disable specific categories from the search results. Deselect the checkboxes next to the categories you want to ignore. You can also drag categories to change their order in the search results. Individual users have their own separate Search Results settings.

Image

To prevent Spotlight from indexing specific local items, click the Privacy tab to reveal the list of items for Spotlight to ignore. To add new items, click the Add (+) button at the bottom of the privacy list and choose the items from a browser dialog, or drag items into the privacy list. You can remove an item from the privacy list by selecting it and then clicking the Remove (–) button at the bottom of the list.

Image

All Spotlight settings are applied immediately. If you add an entire volume to the privacy list, macOS deletes the Spotlight index database from that volume. In turn, removing a volume from the privacy list rebuilds the Spotlight index database on that volume.

Manage Siri Preferences

When you use Siri, the words you say will be recorded and sent to Apple to process your requests. Your device will also send Apple other information, such as your name and nickname; the names, nicknames, and relationships (for example, “my dad”) found in your contacts; song names in your collection; the names of your photo albums; and the names of apps installed on your device (collectively, your “User Data”). All of this data is used to help Siri understand you better and recognize what you say. It is not linked to other data that Apple may have from your use of other Apple services. When you use Siri to search for your documents, the Siri request is sent to Apple, but the names and the content of your documents are not sent to Apple. The search is performed locally on the Mac.

If you have Location Services turned on, the location of your device at the time you make a request will also be sent to Apple to help Siri improve the accuracy of its response to your requests. You may choose to turn off Location Services for Siri. To do so, open System Preferences on your Mac, click Security & Privacy, click the Privacy button, click Location Services, and deselect the checkbox for Siri.

Siri requires an Internet connection to query Apple services to interpret the meaning of your requests. Siri is enabled by default, and you may not want to have an Internet connection by default.

You may choose to turn off Siri at any time. You can disable Siri with Setup Assistant during a macOS setup or upgrade, or from System Preferences > Siri preferences by deselecting Enable Ask Siri.

Image

In addition to enabling or disabling Siri, you can adjust several features from Siri preferences, including:

Image You can select the language that Siri will be expected to understand and respond in. Siri supports over 40 languages and dialects.

Image You can select the voice that Siri will use to speak responses. The choices in the Siri Voice menu are based on the selected language. You can also disable the voice feedback.

Image You can select the microphone input that Siri will use to listen for your requests. The internal microphone on Apple portable computers is optimized for Siri input and often includes noise-cancellation technology. For desktop Mac computers lacking a microphone, or if you are in a particularly noisy environment, you can use a dedicated headset-style microphone.

Image You can select the keyboard shortcut used to start a Siri request.

Image You can click Siri Suggestions & Privacy to modify the list of apps that Siri will learn from and use to make suggestions.

Image

Exercise 16.1 Examine File Metadata

In this exercise, you examine file metadata in the Finder Info window and add custom metadata.

Use Tag and Comment Metadata

  1. Log in as Johnny Appleseed.

  2. Open Safari, and navigate to www.apple.com.

  3. Choose File > Save As (or press Command-S).

  4. In the Tags field, enter Apple Info. The tag might complete automatically if a previous participant performed this exercise using the same iCloud account.

  5. If necessary, in the menu that appears, click the “Create new tag ‘Apple Info’” option.

  6. Click elsewhere in the dialog to dismiss the Tags.

  7. Ensure that the location (the Where menu) is set to Documents and that Format is set to Page Source, and click Save.

    Image
  8. Quit Safari.

  9. In the Finder, navigate to your Documents folder (choose Go > Documents, or press Shift-Command-O).

  10. Select the web archive file, probably called “Apple,” and choose File > Get Info (or press Command-I).

  11. Expand the General, More Info, and Comments sections of the Info window.

    The Info window in the Finder displays information about the file, for example:

    Image Basic metadata such as its size

    Image Information about where on the web it came from

    Image The tag you added when you saved it

    You can also edit some metadata types in the Info window.

  12. In the Comments section, type The Apple Orchard.

    Image

    This field adds custom metadata to the file, enabling you to attach searchable comments and keywords. You see how to use this comment later, in step 2 of “Use Spotlight to Search for Documents.”

  13. Close the Info window.

  14. If necessary, change the Finder view of the Documents folder to list view (click the List View button in the toolbar; choose View > as List; or press Command-2).

  15. Choose View > Show View Options (or press Command-J).

  16. In the Show Columns section, select Comments and Tags.

    Image

    This setting applies only to this folder. If you click “Use as Defaults” you make it the default for all folders.

  17. Close the View Options window, and if necessary, widen the Documents window until you see the Tags and Comments fields.

    Image
  18. Close the Documents window.

Use Spotlight to Search for Documents

  1. In the Finder, choose File > Find (Command-F).

  2. In the Search field of the window that opens, type orchard.

    The search finds the web archive you saved earlier because the word “orchard” appears in its Spotlight comment. You can also restrict the search to files with “orchard” in the name.

    Image

    Spotlight searches file contents and all metadata. It displays all matches and then suggests ways to narrow your search (for example, it suggests only filename matches or “downloaded from” matches).

  3. Change the Search field to apple info.

    This time Spotlight finds the archive file by its tag and gives you options to restrict the search to name or tag matches only. Since it is searching all file attributes, it may find other matching files.

    Image
  4. Change the search to apple.com.

    The web archive is found, this time because your search matches the site it was downloaded from. It also finds the Dock.mobileconfig file in the ParticipantMaterials/Lesson3 folder, because it contains a document type descriptor that says it conforms to a format defined at www.apple.com/DTDs/PropertyList-1.0.dtd. If you had text or PDF files that mentioned www.apple.com, they would also be listed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.159.164