When I search for text in a .html file using the Command-Spacebar spotlight popup the .html file is never shown in the results. On the other hand the .html file does show in the result when I search in the Finder window search field, or when I search in the Terminal using mdfind
.
Why is this and how can I fix? I want to use spotlight to find .html files.
You can reproduce the problem like this:
echo spotlighttest > testone.txt
% echo spotlighttest > testtwo.html
% mdfind spotlighttest
2024-12-30 14:22:28.552 mdfind[28326:550500] [UserQueryParser] Loading keywords and predicates for locale "en_US"
2024-12-30 14:22:28.553 mdfind[28326:550500] [UserQueryParser] Loading keywords and predicates for locale "en"
~/Desktop/Spotlighttest/testone.txt
~/Desktop/Spotlighttest/testtwo.html
I believe this shows that both files are index properly, but if you then do Command-Spacebar and search for "Spotlighttest" I think you will see that only testone shows as a result.
Edit I believe this is a change in macOS 15.x and used to work correctly in previous macOS