Not matching content

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

Moderator: Mr_Noodle

Not matching content Tue Aug 15, 2023 4:17 pm • by jswright61
I downloaded a pdf. I have a rule that operates if certain content exists in the file. When I open the pdf in Preview I can select and copy the text I am looking for. When I paste that text, it contains the exact phrase my rule expects to see. Yet the rule does not fire, and when I preview the rule on the pdf, it has an ❌ next to the Contents contain rule.

I did an mdls on the file and the metadata looked right.
Not sure what to do.

Possibly related: I got a new M2 MacBook Air a few weeks ago. This rule ran flawlessly on my old 2019 Intel MBPro.
jswright61
 
Posts: 11
Joined: Tue Aug 20, 2019 4:40 pm

Re: Not matching content Wed Aug 16, 2023 8:32 am • by Mr_Noodle
Are you using "Contents contain" or "Contents contain match"?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Not matching content Wed Aug 16, 2023 8:47 am • by jswright61
"Contents contain"
jswright61
 
Posts: 11
Joined: Tue Aug 20, 2019 4:40 pm

Re: Not matching content Thu Aug 17, 2023 8:49 am • by Mr_Noodle
My guess is a Spotlight issue. Can you post the mdls results?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Not matching content Thu Aug 17, 2023 9:56 am • by jswright61
Thanks for the help on this BTW.
Here's the mils results:
```
_kMDItemDisplayNameWithExtensions = "Cape & Coast Statement 2023-07-31.pdf"
kMDItemContentCreationDate = 2023-08-15 19:55:28 +0000
kMDItemContentCreationDate_Ranking = 2023-08-15 00:00:00 +0000
kMDItemContentModificationDate = 2023-08-15 19:55:28 +0000
kMDItemContentType = "com.adobe.pdf"
kMDItemContentTypeTree = (
"com.adobe.pdf",
"public.data",
"public.item",
"public.composite-content",
"public.content"
)
kMDItemCreator = "Chromium"
kMDItemDateAdded = 2023-08-15 20:05:51 +0000
kMDItemDisplayName = "Cape & Coast Statement 2023-07-31.pdf"
kMDItemDocumentIdentifier = 386699
kMDItemEncodingApplications = (
"GPL Ghostscript 9.25"
)
kMDItemFSContentChangeDate = 2023-08-15 19:55:28 +0000
kMDItemFSCreationDate = 2023-08-15 19:55:28 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "Cape & Coast Statement 2023-07-31.pdf"
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 51306
kMDItemFSTypeCode = ""
kMDItemInterestingDate_Ranking = 2023-08-15 00:00:00 +0000
kMDItemIsUploaded = 1
kMDItemIsUploading = 0
kMDItemKind = "PDF document"
kMDItemLastUsedDate = 2023-08-15 19:58:53 +0000
kMDItemLastUsedDate_Ranking = 2023-08-15 00:00:00 +0000
kMDItemLogicalSize = 51306
kMDItemNumberOfPages = 3
kMDItemPageHeight = 792
kMDItemPageWidth = 612
kMDItemPhysicalSize = 53248
kMDItemSecurityMethod = "None"
kMDItemUseCount = 5
kMDItemUsedDates = (
"2023-08-15 04:00:00 +0000"
)
kMDItemVersion = "1.7"
```
jswright61
 
Posts: 11
Joined: Tue Aug 20, 2019 4:40 pm

Re: Not matching content Fri Aug 18, 2023 8:48 am • by Mr_Noodle
If you search in Spotlight using the same text you entered into Hazel, does that file show up in the results?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Not matching content Fri Aug 18, 2023 9:58 am • by jswright61
YES!
I had previously manually renamed the file and moved it, but I just re-downloaded the statement. It went to my Downloads folder with a name pdf.pdf. I searched Spotlight for Both contents phrases and both returned that new file in my Downloads folder. However when I preview the rule on that file, it still fails on the 2 contents terms.
Sorry, I know this is the first mention of 2 separate contents rules, but as they were both failing I decided to focus on one fail. I hope this did not lead your troubleshooting astray.I was going to add a screenshot but attachments are apparently disabled in this forum. Suffice to say, both Content contain rules fail in the preview.
Perhaps significant: There is a Contents contain match rule to extract the date which is green.

And, BTW - this is great support, I truly appreciate the help!
jswright61
 
Posts: 11
Joined: Tue Aug 20, 2019 4:40 pm

Re: Not matching content Mon Aug 21, 2023 8:40 am • by Mr_Noodle
You can post images directly here. Try a service like imgur.com if you don't already have your own cloud sharing service.

It might be better to stick with "Contents contain match" though. It is more reliable as it doesn't use Spotlight, but at the expense of some performance.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Not matching content Mon Aug 21, 2023 3:55 pm • by segfault
I was having the exact issue mentioned by OP (rules not matching when using a "contents contain" condition) and I was able to solve it just by forcing Spotlight to reindex using the good old traditional
Code: Select all
sudo mdutil -a -E
command. The issue happened after using Migration Assistant to move all data associated with a macOS Ventura installation to a new machine.
segfault
 
Posts: 2
Joined: Sun Jan 18, 2015 7:59 pm


Return to Support