2

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)
2

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

2

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

  • Thank you very much klanomath. I'm slightly confused about the discrepancy between "width" and "word-based" for the "w" in your answer. – Redarm Oct 24 '17 at 14:05
  • @Redarm Me too, two sources with slightly different explanantions... – klanomath Oct 24 '17 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .