Finding your stuff with Windows Search doesn’t require you know or even care about Advanced Query Syntax, but if you have 1000s of images, music files, and videos, then it sure helps. AQS really shines when you’ve saved your stuff in a safe place but can’t remember where that place is, so even if you’ve lost something, it’s never really lost if you know how to look for it!
Old documents, e-mails, contacts, and spreadsheets can often get lost in a crush of data clutter. The result, we often have a vague idea where a particular file is but no exact clue how to find it. That’s where AQS comes in handy. The nice thing about AQS is you can quickly slice your way through that clutter and narrow down your search to a few select files.
The whole point of AQS is to help users “better define and narrow their searches.” In this lesson, we’re going to briefly introduce you to AQS but the focus of this chapter will be to teach you tools you can use to further extend your searches and get more definitive results, which will logically lead into our last lesson about AQS parameters.
These tools include Boolean operators, date operators, and wildcards. You can most definitely search without these tools, and that may be enough to find what you’re looking for, however, things like Boolean and wildcards really enhance searching and speed up file finding greatly especially if you’ve a lot of stuff stored or archived.
Let’s Talk About Boolean Operators, Again
We mentioned Boolean operators earlier in this series, now let’s talk about it in greater detail. Boolean allows you to combine search operators to narrow or broaden your results. For example, you can constrain a search with NOT. For example, you could search for all image files but NOT bitmap files. On the other hand, you could search for music files OR image files, meaning that your search will return results with both file kinds.
Let’s walk through some Boolean operators so you know how they work. Note, Boolean operators should be fully capitalized and you cannot use NOT and OR in the same query.
|Expression||Examples||How it Works|
|NOT||apple NOT pie||Finds instances of “apple” but NOT “pie”|
|–||apple –pie||Returns instances of “apple” but not “pie”|
|OR||apple OR pie||Finds anything with “apple” OR “pie”|
|Quotation marks||“apple pie”||Finds the exact phrase “apple pie”|
|Parentheses||(apple pie)||Returns results that contain the terms apple or pie in any order|
|>||date:>12/31/99size:>10000||Finds files created after 12/31/99Finds files larger than 10000 bytes|
|<||date:<11/05/04size:<10000||Finds files created before 12/31/99Finds files smaller than 10000 bytes|
|..||date:12/31/99..12/31/00||Finds files with creation dates from 12/31/99 to 12/31/00|
You can actually create a search using only Boolean. Let’s create an example, we want to find a file, created after October 31, 2012 with the phrase “How-To Geek”:
Searching through our Documents folder we’re given four results dated after October 31, 2012 with “How-to Geek” somewhere in the name or folder. That should be pretty easy to understand. The best thing about Boolean is that it works best when combined with AQS search parameters.
And, Boolean Properties
You can also find certain file types using Boolean properties. Let’s look at these properties and show you how they work. The following table is pasted directly from Microsoft’s documentation on AQS with some minor tweaks to make it geekier.
|is:attachment||geek is:attachment||Use this to find attachments with the word “geek” (same as isattachment:true)|
|isonline:||geek isonline:true||Finds things which are online and contain the word “geek”|
|isrecurring:||geek isrecurring:true||Locate recurring items with “geek” in them|
|isflagged:||geek isflagged:true||Returns results with “geek” that have been flagged, such as for review or follow-up|
|isdeleted:||geek isdeleted:true||This will show you items that have been deleted that have “geek”|
|iscompleted:||geek iscompleted:false||Returns “geek” results that have been flagged incomplete|
|hasattachment:||geek hasattachment:true||Similar to isattachment only this shows results with items that have “geek” and an attachement|
|hasflag:||geek hasflag:true||Any item with “geek” that has flags|
We’re not going to spend any meaningful time on Boolean properties. They are most useful such as when searching through Outlook, which is beyond the scope of this series.
However, if you do use Outlook, once you’ve read this series, you should be able to apply Boolean properties on your own to more easily find messages, especially if you have thousands and aren’t sure how to find the one you’re seeking!
A Quick Note on Dates
Let’s turn our attention briefly to dates. We described how to use Boolean to return results based on dates, either before or after a certain date or between two dates. You can actually take this quite a bit further and use relative date and day values.
This should be pretty easy to understand. Let’s try an example so we can make sure it’s firmly in your mind. Let’s say we want to search to see what we wrote in the last month, in this case June 2014. We could write the date range out like “date:6/1/2014 .. 6/30/2014” but that takes a bit more time. It’s much easier to write “date:last month” and get the following result.
Granted, if you wanted to constrain your results for months beyond June, you’d have to use the range function. Then again, knowing the relative date values can ultimately help you cut a few corners and save time.
Also, remember you can further refine your results by using other search operators such as titles and keywords. Let’s say that we want to see all the files in our Dropbox that were created in the last year with “geek school” in them.
If we simply search for files created in the last year, we’re shown almost 1300 results and if we search only for “geek school” we’re overwhelmed with around 1100 results. But if we combine the two search operators, we see how quickly we can narrow down our results to 52 items:
So, to sum up, you can use Boolean to find files by date following a number of methods. You can find files before (<) or after (>) a certain date, you can file files created during a time period or range of dates (..), and you can use relative values such as we just described (last week, last month, last year).
Wildcards are symbols you can use when you don’t know exactly what you’re looking for but can almost guess. There are two wildcards supported in Windows Search: “*” and “?”.
Wildcard *: Searching for Unknown Strings
Using an asterisk allows you to replace a string of text. This is often useful if you know what kind of file you’re looking for but don’t know where it is. For example, let’s say you want to find a .jpg file that may be in a folder, which contains further subfolders. You could open each folder and sort the contents by its type in the details view. Or, you could use the * wildcard.
Obviously, trying to find one particular .jpg from almost 9000 items is going to take a lot of time, so you’d most definitely want to use other search operators to narrow your results. Like we mentioned, however, the * wildcard is used to replace a string of text.
So, in the following screenshot, we search for “image*.jpg” and are shown all instances of image files starting with “image” and ending with “.jpg”:
Obviously, 6308 files is still a lot, but it’s a lot less than 9000 and it does illustrate how the asterisk wildcard works. Let’s now look at how the question mark wildcard works.
Wildcard ?: Searching for Unknown Characters
Simply, the wildcard ? lets you replace it for any character in a search. This means that if you’re looking for a file and you’re not sure how it is spelled, you can simply substitute “?” for the characters you don’t know.
In the following example, we search for files that start with “img_2” and end with “.jpg”.
We’re unsure which three numbers follow so we substitute it with question marks. Of course, you could insert a * here, but if you do that, you’ll get results with more and less than three characters. In this case, we’re specifically looking for files with three characters between “2” and “.jpg”.
Let’s look at one more example, this time combining both wildcards in one search. In this screenshot, we want to search for Led Zeppelin mp3s but we’re not sure exactly how it’s spelled. Is it “Led” or “Lead” at the beginning? Is it “Zeppelin” or “Zeppelen?” Let’s try a wildcard search for “*zeppe???.mp3”and see what happens.
You see in this example, the * takes the place of the first three or four characters. In this case, it replaces “Led_”, while the three question marks at the end replaces what turns out to be “lin” and not “len.” Note also, we amend the end of the search with .mp3 so it is constrained to that type of file. If it weren’t, we’d likely also see images and text files as well.
So that’s it for wildcards. We think they’re pretty easy to understand and extraordinarily useful in a search pinch. Let’s delve briefly into actual AQS parameters before we conclude today’s lesson.
An Introduction to Advanced Query Syntax
When you use AQS, you can narrow your searches using four parameters. We just want to make sure you’ve got this firmly in mind before we unveil tomorrow’s lesson.
You can use AQS to search locations such as specific folder or you can query databases such as Microsoft Outlook data files. These are known as file stores.
Use AQS to search for kinds of files, which can be anything such as documents, image files, spreadsheets, and more. File kinds are one of the more frequently-used parameters you will employ when conducting proper searches.
File properties are the things that describe a file such as its size, the date it was created/modified, its titles, and more.
In the above screenshot, we see the properties sheet for an mp3. On it we see the type of file it is, its location, size, and dates (created, modified, and accessed). These are “common” properties and can be found on any file.
There are also “specific” properties, which apply only to a certain file’s type. For example, in the case of our mp3, we can also search for bit rate, artists, genre, album name, and more. The same holds true for communications, video files, recorded TV, pictures, contacts, etc.
You can use contents searches to search your files for certain keywords. Content searches are applicable to files that contain text, such as documents, spreadsheets, presentations, and other similar file kinds. You can’t really search for images, videos, and music unless you have extra information (metadata) written to that file which can be located from the properties.
Text files are an excellent example. Let’s say we have a bunch of text files, and we want to search for instances of “to be or not to be” or maybe we just want to find Hamlet. Because “to be or not to be” is contained within Hamlet’s content, we can simply search for that phrase and it will be shown in the results.
As you can see, our content search quickly reveals the location of Hamlet among our books, and there is only one instance of Hamlet and thus one instance of “to be or not to be.”
You can imagine how useful this might be if you remember a turn of phrase you used in a paper you wrote in college, or a book you read on your tablet, but you have no idea what or where it is. Simply search from the desktop for that phrase and it should appear in your results!
We’re going to halt today’s lesson right here. Obviously, it’s a lot of stuff to digest but if you understand how these operators work, you can create more pointed queries.
Today’s homework is to try Boolean, dates, and wildcards out. Try finding certain files types using wildcard and then constraining your searches using dates and Boolean. Who knows, you might even find something you totally forgot was on your computer.
Tomorrow, we’re obviously going to wrap up our discussion of Windows Search with a thorough examination of Advanced Query Syntax parameters, and then put everything together so you can see how it all works!