Spotlight in macOS 11.0--11.2.x does not return files if hashtag item is last in a line of text.
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.
It looks like you're new here. If you want to get involved, click one of these buttons!