For reasons I do not understand,
mdfind 'kMDItemTextContent = "*term*"cd'
is not sufficient to find every occurrence of the search term
term. William Cannings on the spotlight-dev list helpfully pointed out that one needs an additional search term:
(* = "term*"wcd || kMDItemTextContent = "term*"cd)
This works its magic in mdfind. But there does not seem to be a way to encode the first clause as an NSPredicate…
(anykey like[wcd] 'term*') or (kMDItemTextContent like[cd] 'term*')
doesn’t do anything more than its second clause.
The folks at CocoaDev suggest using Carbon… which is a rewrite !