At this point, SharePoint 2010 has been out about a year and a half more or less and you might have forgotten some of those new features that came along with it. Since I am often one to talk about SharePoint search solutions, one of my favorite new features we got with SharePoint 2010 was Keyword Query operators. They are all kinds of awesome. Someone coming from a T-SQL background may be far from impressed, but in the search engine world, this is a BIG deal. I’ve written about Search keywords in the past, but I thought this was worth some additional coverage, especially since I am speaking on the topic at SPC11 and it applies to both SharePoint 2010 and SharePoint Online (Office 365).
Since I am talking about getting more out of search with SharePoint Online, I’ll use my Office 365 account for today’s examples. The Keyword Query language for Search was expanded to include operators such as >,>=, <, <=, and <>. These operators are great for comparison against built-in managed properties such as Size and Write (Modified Date).
For example, to see all documents modified since the beginning of this month (September), issue a query like this:
Note, that the spacing (or lack there of) is important. If you put spaces between the operator, property, and value, it won’t work. Remember you can always put the value of the query inside quotes like you see above. This is especially important for values that have spaces in them. Size can be used in the same way to ensure that files are of a certain size. For example, to ensure files are greater than 100,000 bytes, use the following:
This returns files greater than 100,000 bytes (not to be confused by 100k like hard drive manufacturers would like ). Notice, that we are getting an image preview in the search results with SharePoint Online. That’s interesting. We’ll explore it later.
It also supports the “NOT” operator using “<>”. For example, to see everything that is NOT written by me, you could issue the following query.
After all, if I didn’t write it, the content must be good. :) As a reminder, you can combine any of the terms together to get more restrictive results. A space in between terms is the equivalent of the word “AND”. You can also use the keyword OR if desired.
For more information on operators, see this MSDN post. Interested in seeing more that you can do with Keyword queries? Come to my talk (#SPC364) at SharePoint Conference 2011 this October in Anaheim. We’ll cover many way that you can use Keyword queries to get more out of Search.