What is the keyword "type" in Windows Search advanced query syntax?
I found out that the search syntax works differently for folders that are indexed and those that are not indexed. (I think this is very bad.)
For an indexed folder, type:image
, type:jpg
, type:.jpg
and type:=.jpg
work.
For an unindexed folder, only type:=.jpg
works.
Thanks to IT Thug Ninja for the latter syntax.
The full name of the propety that appears in the Type
column is System.ItemTypeText
. The operative word there is "Text". You're searching the text description of the type (if you're searching for a specific extension, just search on the Extension
property).
There are several query operators that are string-specific, but not widely-known, most likely becaause they are buried toward the end of Using Advanced Query Syntax Programmatically. (doesn't exactly bbubble to to the top when you search the web for "Explorer Search syntax" :D )
COP_VALUE_STARTSWITH ~<
System.FileName:~<"C++ Primer"
COP_VALUE_ENDSWITH ~>
System.Photo.CameraModel:~>non
COP_VALUE_CONTAINS ~= or ~~
System.Subject.~=round
or System.Search.Autosummary:~~round
COP_VALUE_NOTCONTAINS ~!
System.Author:~!"sanjay"
COP_DOSWILDCARDS ~
System.FileName:~"Mic?osoft W*d"
COP_WORD_EQUAL $= or $$
System.StructuredQuery.Virtual.From:$="Sanjay Jacobs"
COP_WORD_STARTSWITH $<
System.Author:$<"San"
or System.Filename:$<"Micro Exe"
Searching in non-indexed locations seems to be less forgiving regarding syntax, for instance, searching Program Files
with Type:"file folder"
yields "No items match your search."
, using type:="file folder"
yield the expected results:
But the real "magic bullet" is COP_VALUE_CONTAINS (
~~
)
. Searching Program Files
with type:Configuration
yields no results, but ~~
matches even partial strings. type:~~config
yields types I wasn't even aware of:
It doesn't even reqire wildcards to match partial strings. type:=~~olde
is enough to match any type with "folder" in the description: