Search Effectively

Because Slack works quite a bit like a message-based social network or instant messaging system, important information often scrolls off quickly in active channels and conversations.

Finding that information later has a high value, and this short chapter covers some important ground by detailing how to get the most out of Slack’s Search feature. Unlike a typical search engine, Slack provides context around search results, making it easy to see the portion of the discussion in which they occur.

What Text Does Slack Search?

Slack’s powerful search finds matches for you throughout the available message archive, but only within your personal set of searchable content:

Compose Queries

Every Slack app has a search option in the messaging view, whether it appears as a full Search field or it’s a Search button you tap (in the mobile apps). You can also use the slash command /s in the Message field—it’s a valid command, but Slack doesn’t show it as an option. (You can also type /search.)

Slack lets you type freeform queries. For instance, if you search on apple, the app sends a query to its central store of your team’s messages and brings up every message and uploaded or directly linked file that contains apple—but only from those channels and conversations to which you have access.

Examine Results

In Figure 120, I’ve searched on iPhone in the TidBITS team. The results are sorted into Messages and Files, and show the number of matches in parentheses following each category. Messages includes only regular messages, while Files includes any snippet or post, text in any file that’s been uploaded, and any linked Google Drive, Box, or Dropbox files.

**Figure 120:** A basic search and its results. Notice the controls at the top, including the Recent and Relevant buttons, the Messages and Files tabs, and the tiny Include pop-up menu.
Figure 120: A basic search and its results. Notice the controls at the top, including the Recent and Relevant buttons, the Messages and Files tabs, and the tiny Include pop-up menu.

Let’s look at what you can do with the search results in the Messages tab. By default, each result both highlights the matches in the message and shows the preceding and following messages, as well as the channel or conversation name and date.

From the search results list in the desktop and Web apps, you can:

In a mobile client:

In the desktop and Web apps, you can also:

Refine Searches

You can enter more specific search terms to refine your search better. This is useful when you’re looking for something particular or when you get too many matches from a general search query—or not enough.

You can start by restricting matches to phrases by putting a set of words in quotation marks, like "iPhone malware".

To make a broader match, try wildcard matching by adding an asterisk (*) at the end of a full or partial word. The stub has to have at least three letters before the asterisk. For instance, if you want to find detail, detailed, details, and detailing, you could search on detail*.

If you want to further nail down a search, you can limit it to a date range, channel or person, or a message property. All this makes it easier to pinpoint what you’re looking for.

Search by Date

Slack lets you limit results by date with a bunch of different words: before: and after: to set limits, on: or during: to define an entire period (like a day or month), and explicitly yesterday and today, as well as week, month, or year to refer to the most recent week, month, or year. So you can see before:month (meaning the previous month) or after:yesterday (if you’re a Paul Giamatti fan).

Precise date formats must be one of MM/DD/YYYY, MM-DD-YYYY, YYYY-MM-DD, or YYYY/MM/DD. The European DD-MM-YYYY isn’t supported.

As an example, you might want to find messages between June 1 and June 30, 2015. You could express this in at least three ways:

Of course, you can combine any of these with additional search terms, so to find messages in the month of June containing the word iPhone, you’d search on: iPhone during:june

In the desktop and Web apps, as you type a special search term like before or on, notice that the term appears in the Modifiers area of the Assisted Search popover. Click the term, and the popover helps you construct your search—exactly what you see depends on the modifier. With a date, Slack provides a calendar, which lets you click a date instead of stressing out about entering dates in the precise form required (Figure 121).

**Figure 121:** Enter a search-refining term, like `before:`, and Slack offers advice or additional selection help, like this calendar.
Figure 121: Enter a search-refining term, like before:, and Slack offers advice or additional selection help, like this calendar.
Search by Channel or Person

Narrowing a search to a channel or person often provides more useful results. Use in: followed by a channel name, like in:pets-cats, or a person’s name, like in:glennf, which matches within conversations with that person. I’ve found that while you can use from: and to: with handles, from: matches correctly, while to: does not—it’s a synonym for in: (Figure 122). A special case to find your messages? Use from:me.

**Figure 122:** You can limit results to a specific person by specifying `from:` and their handle.
Figure 122: You can limit results to a specific person by specifying from: and their handle.

Combining a channel and a person in one query finds even more precise matches, such as when someone offers a particular insight. For instance, in:random in:michael lets me see all the bon mots from my colleague Michael Cohen.

Search by Star, Link, or Emoji

To only find messages you’ve starred, use has:star. You can also restrict messages to those that contain a link (any link) with has:link, and to specific emoji by using has:, followed by the Slack emoji name in the usual format with colons on either side, like has::robot_face: . You can’t use autocomplete in this one case; you’ll have to look up the emoji name in order to enter it.

I might type in:mac-news from:tonya has:link to get a summary of all links that Tonya has posted in the mac-news channel.