Page 1 of 1

Rules with "contain" condition no longer work

PostPosted: Wed Aug 19, 2020 10:07 pm
by khorton15
I'm having issues with rules that use "contain" conditions to select PDF documents. The conditions, which worked in the past, no longer work. Preview shows that the conditions are not matched. The text in the condition is found in the document, as evidenced by "hazelimporter ...". The rules start working again if I change the conditions from "contain" to "contain match".

I have stopped and restarted Hazel. I have rebooted the computer. Nothing helps.

Any insight is appreciated, as changing all the "contain" conditions to "contain match" would be a large project.

Re: Rules with "contain" condition no longer work

PostPosted: Thu Aug 20, 2020 10:45 am
by Mr_Noodle
"contain" uses Spotlight so it would seem that your Spotlight index needs to be fixed. Make sure that the folder/files in question do not fall under your Spotlight privacy settings and look up online for how to re-build the index (there are several methods so choose the one you are most comfortable with).

Alternatively, you can keep using "contain match", which does scan the file directly, at the expense of performance.

Re: Rules with "contain" condition no longer work

PostPosted: Thu Aug 20, 2020 11:09 am
by khorton15
Mr_Noodle wrote:"contain" uses Spotlight so it would seem that your Spotlight index needs to be fixed. Make sure that the folder/files in question do not fall under your Spotlight privacy settings and look up online for how to re-build the index (there are several methods so choose the one you are most comfortable with).

Alternatively, you can keep using "contain match", which does scan the file directly, at the expense of performance.

Thanks for the info and advice.

I've triggered a rebuild of the Spotlight index. Fingers crossed that this works and lasts.

If a rule has multiple "contain match" conditions, does it read the file once for each condition, or are the file contents cached somehow? I'm wondering how big the performance hit is if I have complicated sets of conditions.

Re: Rules with "contain" condition no longer work

PostPosted: Thu Aug 20, 2020 4:41 pm
by khorton15
There may be something else going on. Spotlight finds the files using the same text as in the condition (as evidenced by mdfind), but the Hazel does not see the file as a match.

I'll switch to "contain match" as required to keep things working. But maybe there is a bug lurking.

Re: Rules with "contain" condition no longer work

PostPosted: Fri Aug 21, 2020 10:27 am
by Mr_Noodle
Does the text you are looking for also appear in the file name?

Re: Rules with "contain" condition no longer work

PostPosted: Fri Aug 21, 2020 10:39 am
by khorton15
Mr_Noodle wrote:Does the text you are looking for also appear in the file name?

No. The file name was very generic.

Re: Rules with "contain" condition no longer work

PostPosted: Mon Aug 24, 2020 10:32 am
by Mr_Noodle
Can you email in the file and the rule?

Re: Rules with "contain" condition no longer work

PostPosted: Sun Jan 03, 2021 5:18 pm
by redseagoby
Same here, running Mac OS 10.15.7
both Spotlight and Houdahspot can find the string (it's an account number inside a downloaded pdf). Number can be copied to pasteboard from Preview, and pasted into a TextEdit file. Yet Hazel cannot match using "Contents contain." When I switch to "contain match" it works. I'm running a two step rule, with name contains "estatement" and then the Contents test. So it would seem to be something between Hazel and Spotlight. Oddly, after I ran all of these tests, I was able to switch the setting back to "Contents contain" and the rule matched and processed.

Re: Rules with "contain" condition no longer work

PostPosted: Mon Jan 04, 2021 12:28 pm
by Mr_Noodle
If it works later, that implies that Spotlight is slow to index the file. You may need to look into that.

Re: Rules with "contain" condition no longer work

PostPosted: Mon Jan 04, 2021 1:07 pm
by redseagoby
Thanks. Haven't tested this, but this thread suggests it is a systemic issue with Catalina.

https://apple.stackexchange.com/questio ... n-catalina