What does the “cdw” do exactly in the canned Search for “Recents”?
Question
The Finder's sidebar search for "Recents" (in High Sierra) is a raw query, which can be found here:
/System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/Resources/search.savedSearch
.
The query string goes like this:
(kMDItemLastUsedDate = "*") && ((kMDItemContentTypeTree = public.content) || (kMDItemContentTypeTree = "com.microsoft.*"cdw) || (kMDItemContentTypeTree = public.archive))
This also looks for Microsoft stuff. The relevant part of the query is:
kMDItemContentTypeTree = "com.microsoft.*"cdw
What does the "cdw" part of this query accomplish? And what does it stand for?
I found another mention here for mdfind
usage:
https://gist.github.com/cwalston/7425465
! -interpret Force the provided query string to be interpreted as if the user
! had typed the string into the Spotlight menu.
! For example, the string "search" would produce the following
! query string:
! (* = search* cdw || kMDItemTextContent = search* cdw)
Solution
cdw is an abbreviation for these search queries with this functions:
c: Case insensitive
d: Diacritical insensitive
w: Word-based, and detects transitions from lower- to uppercase
Source:
Mac OS X Snow Leopard for Power Users: Advanced Capabilities and Techniques by Scott Granneman
OTHER TIPS
The cdw at the end of the query string means the comparison should ignore case, diacritics, and width (which is mostly relevant for text with Asian characters).
1st source: How can I find files by content in mac os x?
Use this modifier... To specify a comparison that is...
c Case insensitive.
d Insensitive to diacritical marks.
w Word-based. In addition, the comparison detects transitions from lower-case to upper-case.
t Performed on the tokenized value. For example, values passed directly from a search field are tokenized.
2nd source: CSSearchQuery