SEARCH

LEARNING TO USE WINDOWS SEARCH / HOW-TO GEEK SCHOOL

How-To Geek

Lesson 5: Use Advanced Query Syntax to Find Everything

Learning Windows Search

We arrive at our final lesson in our Windows Search series, and logically we’re ending on what we’ve been building up to the whole time: Advanced Query Syntax, namely AQS parameters. Understanding these parameters and how to use them will give your searches that extra oomph they’ve been sorely needing and will ultimately crown you all as Search Masters!

Throughout this series you’ve learned how to use Windows Search to find your stuff. Lesson 2 was devoted solely to searching from the Start feature, either the Start menu found on Windows 7 and earlier versions, or the Start screen on Windows 8.1. That’s the easy stuff, and for anyone who just wants to find indexed files instantly, there’s little reason to stray from it.

But, as we learned in Lesson 3, searching from the desktop or, more accurately, File Explorer, means you can quickly locate stuff in non-indexed locations. More importantly, the Search Tools ribbon lets you easily refine your searches using some of the same syntax that we’re going to learn about in this lesson.

In fact, if you really want to extend your searching and build your prowess, Lesson 4 introduced you to even further tools you can use to refine your searches. These tools include Boolean and wildcards, both of which can help you narrow down your queries in just a few key presses.

So now, here we are, at the end of our series and it’s time to finally dive in and learn all about Advanced Query Syntax, as we’ve been referring to throughout. In this lesson, we’re going to cover the four AQS parameters we mentioned at the end of Lesson 4: stores, properties, kinds, and contents.

Syntax: How a Search Query is Constructed

When you perform a search using AQS, you start with a search query. This can include one or two keywords, which can include a simple phrase such as “to be or not to be” or a file name “img2467.jpg.” You can also string together queries with Boolean and optional search operators including content, data stores where a file resides, the kind of file, and the properties of a file.

When you write a query with optional criteria, you use the following syntax:

  • data store or scope:value
  • file kind:value
  • property:value

To envision how this works, let’s say we’re looking for short (1 to 5 minutes) music files with “Led Zeppelin” in them. That search might look like this.

clip_image001

Note the search is constructed with the main search query “led zeppelin” followed by optional criteria intended to pare down your results:

Content = Led Zeppelin + file kind = music + length = short (1 – 5 minutes)

We could search only for “Led Zeppelin” but this could include images, text files, and videos. What we need is to constrain the search to music files only but then we don’t want all Led Zeppelin music files, we want ones that are one to five minutes in length.

This is how AQS lets you cuts through your data instantly, which is great news for those of us who have collected way too many files over the years (guilty)! As we mentioned in the last lesson, there are four parameters you can use to effectively employ AQS: stores, kinds of files, properties of files and finally, file content.

Let’s explore each parameter, explain what they’re for, and then give you some examples of how they’re used.

Finding Items by Data Store

Data Store queries allow you to search for stuff depending on where it is located, whether it is a specific folder, the desktop, or a database.

Let’s say you open File Explorer and you want to search specifically in your Documents, or Desktop, or you want to search for e-mail specifically in Outlook, instead of hunting for a place to conduct your search, you can specifically tell Windows where to search.

Microsoft has a list of possible queries you can use when searching stores.

Restrict Search by Data Store Use Example
Desktop desktop store:desktop
Files files store:files
Outlook outlook store:outlook
Outlook Express oe store:oe
Specific Folder foldername or in foldername:MyDocuments or in:MyDocuments

While we can see the value of this, it’s unlikely something you will use regularly, perhaps never. It seems far easier just to browse to the location you want to search. In fact, once everything is completely indexed you will find search results appear instantly so telling it where to search, unless you have a lot of stores (such as across a network), is kind of unnecessary.

Let’s move onto AQS parameters you will find far more useful, starting with kinds of files.

Kinds: Finding Files by What They Are

Every files is a kind whether it is a program, a document, a music file, or any of the other hundreds of file types on your hard drive. You can usually tell what a file is by looking at its extension, the string of characters following a filename. Extensions are usually three characters long, such as .mp3 or .gif, but it can sometimes be more or less, such as in the case of .ai or .jpeg.

In the following screenshot, we see a search for documents. Note that you can see all the various document files that Windows can search for, including .doc, .docx, .txt, .xml, pdf, and more.

clip_image003

So how do you know what kinds of files you can search for? You could check out Microsoft’s (somewhat ancient but mostly relevant) AQS page for a complete rundown, or an easier way is to simply click on the “Kind” button on the Search Tools.

clip_image005

There are a lot of choices here. As you can see, it’s pretty easy to discern what they all do. You’ll probably end up searching for the more popular kinds of files such as documents, music, folders, pictures, and others.

We’ll talk more about how to use the kind syntax shortly. In the meantime, let’s talk about properties and then move on to contents.

Properties: Searching by How a File is Defined

We talked briefly about file properties in the last lesson. Basically, file properties describe a file according to common attributes such as size and dates (creation, modified, and accessed). Every file has these properties, which is why they are considered “common” but know also, each file type will have properties that are specific to it.

For example, a music file has properties such as bit rate, duration, album, year, and more. Picture files can be found according to camera make, dimensions, date taken, and others.

clip_image006

You can also search properties specific to a file kind. There are a lot of specific properties, far too many to list here, but let’s talk about some basic, oft-used examples: documents, music, and pictures.

Documents

If you look at Microsoft’s AQS documentation, you’ll see you can search for document properties including comments, last saved by, document manager, revision number, document format, and date last printed.

clip_image007

This information can be easily found on the Details tab in the file’s properties.

Music

Music is another common file type and one that can quickly overwhelm a user’s hard drive with hundred or even thousands of files.

clip_image008

From these details you can search for the following properties: bit rate, artist, duration, album, genre, track, and year.

Picture

Finally, let’s take a look at the picture properties. Pictures are another type of file you no doubt have a great number of dotting your hard drive. You can search for a number of image properties: camera make, camera model, dimensions, orientation, date taken, width, and height.

clip_image009

There are other types of file properties you can search for in addition to these, which include attachments, contacts, communications, calendars, presentations, and videos. All these file kinds and their associated specific properties are detailed in Microsoft’s documentation.

Contents: Searching for What is in a File

Finally, there’s content and keywords. Content searches are a recent addition to Windows Search, having only been integrated in Windows 7, but they are very handy.

Content searching is pretty easy to grasp. If you have a document and you want to search for its contents, you can type in a phrase contained within your document and it will pop up in your results. In fact, we actually showed you an example of this in the previous lesson when we searched for text files with the phrase “to be or not to be.”

clip_image011

Content searching works best with files, which have searchable content, i.e. text. Music and video files are obviously poor candidates for such searches, however, even those types of files have “content” you can search, though it is metadata, which is technically part of a file’s properties.

clip_image012

In this case, you see that if you just do a simple search for part of the comment in this music file, we get the relevant results:

clip_image013

This is just an example, and it’s pretty specific to the type of file. Obviously you’d need to know what the comments in a music file contain, and it’s easier to simply search for such a file using other parameters, but it can be done.

Using Full Queries to Refine Searches

So let’s put it all together and go through some examples so you can see how this all works. We’ll incorporate the parameters we’ve learned, Boolean, and dates to show you how to make short work of finding your stuff. This will by no means be a comprehensive collection of AQS examples, but it should definitely provide you enough to further explore it on your own.

We’re going to keep this simple and practice with the three files kinds we discussed previously: documents, music, and pictures.

Finding a Long Lost Document

We love strategy video games, especially Civilization. Lately we’ve been on a Civ kick and want to up our game and we know that we have a Civ PDF guide somewhere on our computer.

Sadly, attempts to locate it in the Documents and Dropbox folders have turned up nothing. It’s time to perform a search, the problem though is, we don’t know for sure what it is called exactly, only that it has “civ” in the title, and that it is a PDF file.

No problem – AQS to the rescue! For this kind of search we just need a simple keyword and we can find the document we’re looking for quite easily. In fact, we can do this any number of ways, but we’re going to show you two.

We can find it by keyword (civ) and file kind (document): “civ kind:=document.”

clip_image015

The first result is exactly what we were looking for, however, this particular search returned over 1400 results so we could conceivably still have a confusing mass of results.

Obviously there has to be a more precise way and since we did know that “civ” and “pdf” are a distinct part of the file name, we can try a more pointed search that way: “civ *.pdf.”

clip_image017

In this example we find the result we’re seeking is the only one that appears, so obviously the second method is a bit more efficient. How you search if ultimately up to you, just always remember, if you don’t find what you’re looking right away, there is probably a better way to look for it.

Let’s move on and try some things with music files before closing things out with some image searches.

So You’ve Lost Some Music …

First off, we want to just say that we realize we could just use a media application like iTunes to manage our music but what we’re looking for are the actual physical files.

In our first search, we’re going to locate music files with the word “love” in them.

clip_image019

We find that we’re given quite a few results, in fact, well over 1000 just in this particular search alone. Love is obviously a popular subject for songwriters! How can we possibly narrow down our results? Well, we really want music about love that rocks but not too long, say between one and five minutes.

So, we add a few more parameters to narrow our results down to 46 short, rock-n-roll songs about love:

clip_image021

That will do nicely, and we made short work of our music requirements. If we wanted, we could now just select all these songs and copy them to a removable medium such as a phone or iPod and be on our merry way!

Let’s look at one more example using pictures before we wrap this series up.

Find Those Vacation Pics; Make Your Friends Jealous!

According to some sources, almost one trillion photos will be taken this year, and if you’re like many others, you’ll probably account for a large number of those. While you may be compelled to take 1000s of pictures on your trip to Mexico chances are you’ll forget you took many of them by the time you return until you want to find them again.

Looking for images gives us a great opportunity to use our date operators in addition to every other tool at our disposal. So let’s find those pics so we can take a walk down memory lane without a bunch of hunting.

The initial search seems easy, we’re going to search for keyword “Mexico” and make sure we only find pictures. Alas, we find the pictures we seek, all 1367 of them. That’s obviously way too much.

clip_image023

We only want to find pictures we took in Mexico on July 1, 2012. We can of course, sort the pics by the date modified column, but we want to find things efficiently so we try a more refined search.

clip_image025

By adding the date requirement, we’ve narrowed things down to 267 images. From here on, your choice is to refine our search a bit more or change our view (yes, you can still do that) to icons. Click on the “View” tab on the ribbon and you can view your images in much more detail.

clip_image027

Always remember to use all the resources available to find your stuff. In this case, we managed to narrow what we were looking for to one, manageable day and we should be able to find the exact image we’re looking for now.

Conclusion

We could go on with example after example of searching through Windows using Advanced Query Syntax, Boolean, wildcards, dates, and everything else we’ve learned over the past week. We think, however, that this should give you a clear idea of how all this works. At the very least, you now know all these tools exist, and you have a working knowledge on how to use them.

But you cannot call yourself a Search Master until you actually master your searching. Today’s homework then is to put all this together and practice everything we’ve taught you over these five lessons. Don’t be afraid to try different angles. If you’re not getting the result you’re seeking, or you’re getting too many, there is almost a better way to tackle it.

Thank you for sticking with us, we hope you found this How-To Geek School series useful and remember, if you have anything you want to add, don’t be afraid to sound off in our forum!

Living just north of the border, in what he calls Practically, Mexico, Matt spends his days scouring the latest tech news, writing e-books, and attempting to create the perfect breakfast burrito.

  • Published 07/25/14