Files are tricky things. They are very good at hiding within the file system. Well that’s how it seems to me. If I’m honest, the file does hide really, I just forget or confuse the one I’m looking for with another one. Usually the name, so I end up starting at the top of a folder structure knowing the files was a .docx or .xlsx file. Genius! Fortunately Advance Query Syntax helps me out.
You can use AQS from the search box on the Start menu or from within Explorer, the syntax is the same. AQS is part of Windows Desktop Search and is part of Windows 7 by default. I’ve included a link to version 4.0 below for those not on Windows 7.
What AQS allows you to do is use some of the 300+ attributes that files can have to tag them. So for example, recently I changed managers and I know my previous manager sent me a document about year end stuff. I know I saved it somewhere in My Documents, but where? Using AQS I can open My Documents and type
into the search box. Now I get a list of all the documents with the Authors property set to my managers name. The AQS syntax is made up of
combination. As I mentioned there are hundreds of attributes to choose from. The trick with attributes is understanding how to enter them. For example
are all equal. The rule of thumb is to remove the space from attributes, as in the second one above, or like “Date last printed” becomes “Datelastprinted”.
The value part of the syntax is very flexible and allows for a number of operators. Say, for example, you want to see how many files you have in a folder structure over 250mb, to find those enter
The are some predefined sizes you can use, they are not as granular as the example above.
|Empty:||Files that are 0kb in size.|
|Tiny:||Files 0kb to 10kb in size.|
|Small:||Files 10kb to 100kb|
|Medium:||Files 100kb to 1mb|
|Large:||Files 1mb to 16mb|
|Huge:||File 16mb to 128mb|
|Gigantic:||File bigger than 128mb|
Using size:Gigantic is similar to the example above, but will return more results – if there are files in the 128mb to 250mb range in the folder.
You can take this example further and search for files within a size range. The next two examples are equivalent.
The “..” signifies a range of values, for example
specifies a date range. Depending on where you are in the world read it as all files modified in July or all files modified between January 7th and 8th. Either way, its a date range. You can also search for two specific dates, for example on my machine with the UK date format
datemodified:(1/7/2010 OR 1/8/2010)
Searches for a file modified on either July 1st or August 1st. You can use the AND operator too. The next examples are interesting and taken from the documentation.
authors: (Charlie AND Herb)
authors: Charlie AND Herb
They look similar, but return completely different results. The first example looks for files that are authored both by Charlie and Herb, the second example looks only for Charlie as the author, then looks for Herb in the file name or any other file property. So a Resume document called “Herb Resume.docx” authored solely by Charlie would only appear with the second example.
As a note, when using AND, OR or NOT, they must appear in uppercase in the query.
Let’s look at some other operators now. if you are diligent in maintaining file properties, a useful search maybe to find files that do not have the properties you expect populated.
This search returns all the files who’s authors property is empty. Another nice option is how search recognises certain keyword values. Such as these values related to dates.
Relative dates: Today, tomorrow, yesterday
Multi-word relative dates: week, next month, last week, past month, or coming year. The values can also be entered contracted, as follows: thisweek, nextmonth, lastweek, pastmonth, comingyear.
Days: Sunday, Monday … Saturday
Months: January, February … December
Try these examples:-
Finally, before I let you go play with this, just a reminder that you can use the * and ? operators. For example, in my case sometimes I put my full name into the author field, other times Word uses the alias I entered. To find both variations:-
The area I’ve not covered here is the natural language query, I’ll cover that another time.
Al these publications cover the material in this post.