Clarification on 'contains' vs 'contains match'

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I routinely have issues where 'Contents - contains' does not find text in my searchable PDF files even though Spotlight shows the word(s) as being there and they even show as there in Hazel Preview. In these cases 'contains match' generally seems to work.

I'd just like definitive confirmation that 'Contents - contains' exclusively uses Spotlight while 'Contents - contains match' does not use Spotlight? This seems to have been alluded to in other posts and answers. Also, if 'contains match' doesn't use spotlight, how exactly does it work? Does it just perform a pattern matching scan through the entire file? In that case how does it handle different character sets/representations (or maybe it doesn't)? Just curious :-)

Thanks.
ChrisJenkins
 
Posts: 8
Joined: Sun Jan 28, 2018 11:44 am

"contains" uses Spotlight. A test is to search for the term in Spotlight and see if the file comes up in the results.

"contains match" does pattern matching directly on the file contents. Not sure what kind of issue you mean with character sets though. Can you elaborate?
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks for clarifying. I'm petty sure that 'contains' sometimes fails even though Spotlight has indexed the file and the search term is in there. If I find a confirmed case I will let you know.

When I said 'character sets' I should have really said 'character encoding'. There are lots of potential character encodings that may be used in documents from various sources; Unicode (UTF-8, UTF-16, ...), ISO 8859 and all its variants, Windows-125x and so on. I was curious how (or even if) Hazel's 'contains match' functionality deals with files that may have different character encodings. Maybe it isn't even an issue; I haven't found any actual problems, it was more out of curiosity.
ChrisJenkins
 
Posts: 8
Joined: Sun Jan 28, 2018 11:44 am

If you find a case where it doesn't work then let me know.
Mr_Noodle
Site Admin
 
Posts: 11251
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron