Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
programming4us
Windows 7

Power Searches - AND, OR, and NOT searches, Date and number searches

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
1/2/2012 5:24:00 PM
The ability to click the Start button , type a few characters, and see all items that contain those characters is really a great thing. For most people it'll save a lot of time otherwise spent opening programs or navigating through folders to open a program, document, contact, or message. It's so useful you might not even need to bother with more complex searches.

When you do need a more complex search, you can just use the Search box in Windows Explorer to search for particular types of files, and limit the search by date, filename, size, or whatever. You can create complex searches and save them. When you want to do the same search again in the future, that's handy too. For folks who want still more, there's the query language.

You may have noticed that after you fill in the blanks in an Advanced Search and click the Search button, you see some text in the Search box. Take a look at Figure 1 for an example. There I set the date criterion to Date modified 5/9/2009. This puts the following into the Search box:

datemodified:5/9/2009

Figure 1. Sample search.

That little line of text, called a query, in the Search box is what's actually returning the search results. When you perform the search, Windows 7 actually looks through the whole index. But the query acts as a filter of sorts. Only items that meet the conditions set forth by the query show in the search results. In this example, only files whose Date Modified date is 5/9/2009 show in the search results. Items that don't match the criterion don't appear in the search results. Those items aren't deleted or changed in any way. They're simply "filtered out" so as not to show up in the search results.

You can type your own queries into the Search box to perform complex searches. But, it's not as simple as "asking a question" or typing a bunch of words at random. You have to follow some rules and write the query in such a way that it can be interpreted properly. Otherwise, the search returns the wrong items, or no items at all. The sections that follow look at some ways you can type your own complex queries.

1. Searching specific properties

When you type a word into the search box, the results show files that contain that word in their filename, contents, and properties. For example, a search for jazz finds songs in the Jazz music genre, any folder or file that has the word jazz in its filename or contents, and any file that has the word jazz in any property. In other words, you could end up with a whole lot of files in the search results.

You can always narrow a search down by specifying a property name followed by a colon and the text for which you're searching. For example, a search for genre:jazz finds only music files in the Jazz genre.

Similarly, a search for susan finds all files that have Susan somewhere in the file, name, or a property, whereas a search for from:susan finds only e-mail messages that have the name Susan in the From address (for a local e-mail client, not a Web e-mail client).

You can assign ratings to pictures and music files, and use ratings as a search word. For example, rating:5 stars finds files with 5-star ratings.

2. Greater than and less than

When you're searching a property that contains a date or number, you can use the following comparison operators:

  • =: Equal to (this is assumed if you don't specify an operator below)

  • >: Greater than

  • >=: Greater than or equal to

  • <: Less than

  • <=: Less than or equal to

  • <>: Does not equal

A search for rating:>=4 stars finds pictures and music with 4- or 5-star ratings. A search for width:<600 finds pictures with widths less than 600 pixels. The query modified:<2007 finds files last modified in 2006 or earlier. A search for kind:video size:<300KB finds video files less than 300 KB in size.

3. AND, OR, and NOT searches

You can use the keywords AND, OR, and NOT in searches. You must type the word in uppercase letters. Be sure to include a space before and after the word.

Not using any word is the same as using AND. For example, consider the following search:

Datemodified:5/9/2009 name:koala

That means the same thing as this:

Datemodified:5/9/2009 AND name:koala

Any time you create an AND query, you narrow the search results. Intuitively, you might think it would have the opposite effect. But that's not the way it works. The query is a filter. In order to show up in the search results, a file must meet all criteria posed by the filter. For example, files that don't have koala in the filename property won't show up at all, no matter what's in their Date Modified property. And files that were modified on dates other than 5/9/2009 won't show up either, even if they do have koala in the filename field.

Here's a common mistake that might help to better illustrate. Take a look at this:

filename:(*.jpg AND *.jpeg)

Intuitively, you might expect the result of this search to be files with .jpg and .jpeg extensions. But it's not. The result of this search is nothing! Why? Because the criterion is a filter, not a question. In order to get through the filter, a file would need to have a .jpg extension and also a .jpeg extension. But a file can't have two extensions. Every file has only one filename extension. Therefore, no single file could get past this filter.

When you want to broaden, not narrow, a search, you use OR. For example, take a look at this:

filename:(*.jpg OR *.jpeg)

To get past this filter a file needs to have either a .jpg or .jpeg extension. So the result of the search is all files that have either a .jpg or .jpeg filename extension.

If you don't see filename extensions in search results, click the Organize button and choose Folder and Search Options. Then click the View tab, clear the checkmark next to Hide extensions for known file types, and click OK.


By the way, you don't have to use the * and dot if you use extension:, ext:, or type: as the property name. For example, this search criterion also shows all files that have .jpg or .jpeg extensions:

ext:(jpg OR jpeg)

You're not limited to a single OR. Here's a search that shows all files that have .avi, .wmv, .mpg, and .mpeg extensions:

ext:(avi OR wmv OR mpg OR mpeg)

When you use type: you can use whatever appears in the Type column (in Details view) rather than the extension. For example, this search finds Microsoft Word documents:

type:word

This one finds Word documents that have the word John in the filename or inside the document text:

john AND type:word

Because the keyword AND is assumed if omitted, the following works the same as the preceding one:

john type:word

If you want to look only at the filename and not the contents, use the name: property. For example, here's a query that looks for Excel spreadsheets that have the word Festival in the filename:

name:festival type:excel

In addition to searching for extensions, you can use kind: to find certain kinds of files. For example, kind:music finds music files; kind:picture finds pictures; kind:contact finds contacts; kind:e-mail finds e-mail messages; and kind:communication finds messages and contacts.

The NOT keyword narrows a search by excluding items that match the criterion that follows. For example, when you use the kind: keyword you get both the file type as well as shortcuts that open the file type. To hide the shortcut files, use NOT shortcut. For example, here's a search criterion that shows all communications files excluding any shortcuts to those files:

kind:(communication NOT shortcut)

A search for kind:video shows all video files. This search shows all video files except the ones that have a .mov filename extension.

kind:video NOT extension:mov

It's not always necessary to specify the kind or type of file. For example, consider this query:

homecity:Cucamonga

That one finds all contacts whose Home City is Cucamonga. Because Contacts are the only type of file that have a Home City property, you'd probably only get contacts in the search results even without specifying kind:contact.

You can use tag: as a search property too. For example, the query tag:(alec OR ashley) finds files and that have either Alec or Ashley in the Tags property. The query tag:(alec AND Ashley) finds files that have both the names Alec and Ashley in the Tags property.

If you use the Comments and Categories properties in files, use comment: and category: to search just those properties. Similarly, you can use title: to search the Title property and subject: to search the Subject property.

4. Date and number searches

When searching for files based on a date, you can use the following property names for specific dates:

  • modified: Date the file was last modified.

  • accessed: Date the file was last opened.

  • created: Date the file was created.

  • sent: Date that a message was sent.

  • received: Date that a message was received.

  • taken: Date that a picture was taken.

To search a range of dates, use the keywords followed by a start date, two dots (..), and an end date. For example, to find all pictures taken between June 1, 2007, and September 1, 2007, use the criterion:

taken:6/1/2007..9/1/2007

You can also use comparison operators with date searches. For example, to see all files modified on or after January 1, 2007, use:

modified:>=1/1/2009

You can also use the following keywords with dates:

today

tomorrow

yesterday

this week

last week

this month

last month

next month

this year

last year

next year

For example, this search finds all files modified today:

modified: today

This search shows all files that were created this week:

created:this week

Here's a query that lists all picture files that were taken this month:

taken:this month

To see all files modified between some date (say 1/1/2009) and today, use this query:

modified:>=1/1/2009 AND modified:<=today

If you're interested in a certain month and year, use the month name and year like this:

modified:july 2009

For a day of the week, use the weekday name like this:

modified:monday

The comparison operators work with numbers too. When searching sizes, you can use KB, MB, and GB abbreviations. For example, here's a search criterion that finds all files that are 1 MB or greater in size:

size:>=1MB

Here is one that finds files larger than 2 GB in size:

size:>2GB

Here's one that finds files between 500 KB and 1,000 KB in size:

size:>=500KB AND size:<=1000KB

If you save music in various bit rates, here's a query that will find all files with bit rates greater than 300 kbps:

bitrate:>=300kbps

If you wanted only mp3 files with those large bit rates, use:

bitrate:>=300kbps AND type:mp3

Here's a query that finds all pictures whose height is 800 pixels or less:

kind:picture height:<=800

4.1. Searching for phrases

When searching for two or more words, you'll likely end up with documents that contain the words you specified, but not necessarily in the order you typed them. To prevent that problem, you can enclose the phrase is quotation marks. For example, typing this into a Search box displays all files that contain the words dear and wanda regardless of their relative positions to one another:

dear wanda

But typing the following into a Search box displays files where the words dear and wanda appear right next to each other in the document:

"dear wanda"

4.2. Message searching

For Windows Live Mail messages (both e-mail and newsgroup), key properties include to:, from:, about:, subject:, sent:, and received:. Both to: and from: can contain any word that appears in the To: and From: columns in the message. The about: keyword looks at the contents of the messages, not just the subject line. For example, here is a query that you could enter in the Search box on the Start menu that finds all messages from someone named Kay that contain the word lunch:

from:kay about:lunch

Here's a query that shows all messages addressed to Alan that arrived today:

to:alan received:today

Here's a search that shows all messages addressed to Susan, sent by Alan, that have contract in the Subject line:

to:susan from:alan subject:contract

Here's a query for e-mail messages sent this week from Alan to Wanda that contain the words chow mein:

to:wanda about:"chow mein" from:alan sent:this week

4.3. Natural language queries

Earlier in this chapter you saw an option titled Use natural language search in the Folder and Search Options dialog box. If you choose that, you can omit the colons after property names, and use uppercase or lowercase letters in search queries. This really does make it easier to type most queries. For example, with natural language, the following query finds all messages from Susan that contain the word dinner:

from susan about dinner

This search finds all video files excluding ones with an .avi filename extension:

kind video not avi

Here's the natural language version of the query about chow mein e-mail messages:

to wanda about chow mein from alan sent this week

Here's a query that finds all files whose size is greater than 5 megabytes:

size > 5MB

Here's a natural language query that finds all songs by Led Zeppelin:

music by zeppelin

This natural language query finds all pictures that have the word flower in the filename:

flower pictures

Here's a natural language query that finds all files that contain the word peas, the word carrots, or both words:

peas or carrots

Here's a natural language search that finds files that contain the word peas and the word carrots (though not necessarily together):

peas and carrots

Here's one that finds files that contain all three words, peas and carrots, together:

"peas and carrots"

Looking for a file you just downloaded or saved today? Try this natural language search in the Search box on the Start menu:

created today

Here's a natural language search that lists all files modified yesterday:

modified yesterday

Here are some other natural language searches you can probably figure out without my telling you what they mean:

e-mail received today

e-mail from alec received yesterday

contact message

pictures alec

genre rock

artists Santana

rating 5 stars

Using natural language syntax doesn't mean you can ignore all of the other things described in this chapter. The folder from which you start the search still matters. And all of the other options in the Folder and Search Options and Indexing Options dialog boxes still apply. But in most cases you can type a useful search query with minimal fuss. If you can't get a search to work, try turning off natural language searches and use the stricter syntax with colons after property names.

Other -----------------
- Microsoft Access 2010 : Exporting Information (part 2) - Exporting to XML Files
- Microsoft Access 2010 : Exporting Information (part 1)
- Microsoft Project 2010 : Saving a Set of Columns as a Table
- Microsoft Project 2010 : Adding and Removing Columns in a View
- Metadata and Power Searches : Setting Properties When You Save & Personalizing Searches
- Metadata and Power Searches : Working with File Properties
- Tracking Your Licenses with the Key Management Service (part 2) - Configuring DNS to Let KMS Clients Find the KMS Server
- Tracking Your Licenses with the Key Management Service (part 1) - Installing and Initializing KMS
- Taking Advantage of Volume Licensing : Choosing the Right Volume License Key for Windows
- Windows 7 Kernel Mode Drivers Overview and Operations : KMDF I/O Model (part 2)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Trailers Game
- The Banner Saga 2 [PS4/XOne/PC] PC Launch Trailer
- Welkin Road [PC] Early Access Trailer
- 7th Dragon III Code: VFD [3DS] Character Creation Trailer
- Human: Fall Flat [PS4/XOne/PC] Coming Soon Trailer
- Battlefleet Gothic: Armada [PC] Eldar Trailer
- Neon Chrome [PS4/XOne/PC] PC Release Date Trailer
- Rocketbirds 2: Evolution [Vita/PS4] Launch Trailer
- Battleborn [PS4/XOne/PC] 12 Min Gameplay Trailer
- 7 Days to Die [PS4/XOne/PC] Console Trailer
- Total War: Warhammer [PC] The Empire vs Chaos Warriors Gameplay Trailer
- Umbrella Corps [PS4/PC] Mercenary Customization Trailer
- Niten [PC] Debut Trailer
- Stellaris [PC] Aiming for the Stars - Dev. Diary Trailer #1
- LawBreakers [PC] Dev Diary #4: Concept Art Evolutions
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer