# Spotlight in macOS 11.0--11.2.x does not return files if hashtag item is last in a line of text.

edited April 2021

Hello all,

I've been talking with some other programers and been on the phone with Apple support and figured it might help this community to talk about a bug in Big Sur. Here it is:

Spotlight will not return a file in search where the target search term is preceded by a hashtag and the target search term is the last item on a line, unless it's the last line of the file.

I remember way back one time when spotlight didn't return searches where the target was preceded by ) [meaning something like: ")Imatag". ] and this seems similar.

This is occurring on all my machines now, and obvious could be effecting anyone using a tagging system in text files like many of us use.

Neither the Markdown predecessor "Tags:" nor a first line location overcomes the problem that in a text file an end-of-line word preceded by punctuation is excluded by Spotlight unless it is the last line of the file. (Yes, it seems it's not just hashtags but any punctuation that causes the search to be defeated.)

Here's some text to help explain. Imagine everything below this divider to be a single text file:

=====Contents of Example File Below======
Tags: #MMTop
Tittle: This is an annoying bug

#fooFirst #fooMiddle #fooEnd

The bug is subtle. Spotlight will return a tag search only if the tag is followed by other text, meaning that the last tag before a carriage return is ignored, unless that tag is in the final line of the file.

This file will show up in Spotlight from the search terms (prefaced by a #) for fooFirst and/or fooMiddle and/or fooLastLine but NOT for fooEnd or MMTop. It will show up if the # is omitted for those two terms.

This is only a problem in Spotlight. Apps like The Archive and iAWriter return this file for all the tags in this example including fooEnd and MMTop even when preceded by the punctuation.

#fooLastLine
=======End Of Example File =========


According to Apple it is possible that this bug is only related to updates to Big Sur, not fresh installs, but they are not sure. They are sure that they have received many questions about spotlight search behavior since 11.01 was rolled out.

Post edited by ctietze on

• edited April 2021

As in the past with Spotlight bugs on OS upgrades, this one was ultimately fixed. The latest upgrade to 11.3 delivered April 29 fixed this search bug. Now all of the tags noted above are returned in Spotlight. For what it's worth, while this bug was present I checked for it on a number of machines (Yes, I went down to the Mac Store and types in #fooend a lot, did the same on my daughter's machine, also on colleague's machines. . .like I was some kind of nut) and it seemed isolated to hardware with Intel chips. Anyway, it's solved.

(edit: for typos)

Post edited by DougWrites on
• Thanks for the update! I just updated to Big Sur, 11.3, but come too late to the party it seems

Author at Zettelkasten.de • https://christiantietze.de/