Some handy keywords you might find useful in SharePoint Enterprise Search

Posted Tuesday, July 20, 2010 3:30 PM by CoreyRoth

UPDATED 8/3/2011: DocId

Enterprise Search is one of my favorite SharePoint topics to speak about.  Often in my talks, I use various keyword queries to display results that people often end up asking me about.  Today, I thought it would be useful to show you some of the most useful built-in keywords that you can use to troubleshoot search results or even build custom scopes with.  I see people post in the forums all the time about how to do many of the queries I have in the list below, so I figure this is will be a good post to refer people to.  You can use pretty much all of these with SharePoint 2010 or MOSS 2007 right out of the box (once you crawl).

The ContentSource keyword is incredibly powerful.  You can use it to verify that results exists for a given content source.  For example, if you were having issue crawling a file share and you wanted to see if any results were present or not, you could use this keyword.  Start by identifying the content source in question on your content sources page in your Search Service Application.

EnterpriseSearchContentSources

Note the spelling of your content source exactly.  If I wanted to return everything from the file share, I would issue this query.

ContentSource:"File Share"

On my server I get results like this.

EnterpriseSearchResultsFileShareContentSource

Keep in mind that you can combine these keywords with other ones.  For example if I only want accounting documents on the file share, it would look like this.

Accounting ContentSource:"File Share"

EnterpriseSearchResultsFileShareAccountingContentSource

To query all documents on the SharePoint site itself, you could use a query against the Local SharePoint Sites (Local Office SharePoint Sites on MOSS 2007) content source.  Be warned that this could return a large number of results.

ContentSource:"Local SharePoint Sites"

Another property, more people are more familiar with is IsDocument.  This handy property is a great way to filter out items that are not documents (i.e.: folders, list items, and pages).  You pass a value of 1 for true.  In the example below, I return all documents on my SharePoint server.

IsDocument:"1"

EnterpriseSearchResultsIsDocument

If you have spent time building custom scopes, you might be interested in the Scope keyword.  This makes it easy to query everything in your scope at once.  You can use this to build advanced queries or just for simple troubleshooting of the scope.  In this example, I have a scope with rules only to show items from a BCS content source with a property called Color set to red.

Scope:"Red Products"

EnterpriseSearchResultsScope

A lot of times people ask questions about how to just show results for a given site or site collection.  Maybe even a specific document library.  You can do that with contextual search, but you can also do that with the Site keyword as well.  Simply pass it the URL to the specific point on your site and it will filter the results.  For example, if I just want to see results from my ECM subsite, I would use the following query.

Site:"http://sp2010/ecm"

EnterpriseSearchResultsSite

Sometimes you might want to see all documents a particular user modified.  The author keyword is a great way to find things when you want to see all documents from someone that recently left the company.  For example, to see all of the documents by our fictitious CFO, Christina Murphy, we would use this query.

Author:"Christina Murphy"

EnterpriseSearchResultsAuthor

If you know you only want to see documents of a certain content type, why not query for it? You can with the ContentType keyword.  For example to search all documents of my custom type called Custom Document, I would use the following query.

ContentType:"Custom Document"

EnterpriseSearchResultsContentType

You can also write queries based on list template such as a document library, task list, or your own custom list template with the ContentClass keyword.  Simply use any known content class with the keyword (here is a list).  For example, to search only items in a task list, I would issue the following query.

ContentClass:"STS_ListItem_Tasks"

EnterpriseSearchResultsContentClass

Want to see a query that only has Excel spreadsheets? No problem.  Use the FileType keyword.  Don’t include the period on the extension.  You can use multiple FileType keywords together to span multiple types (i.e.: xlsx and xls).

FileType:"xlsx"

EnterpriseSearchResultsFileType

Another keyword I will cover is Write.  You use it to query documents based on modification date.  You can’t take full advantage of this keyword in MOSS 2007, but in SharePoint 2010, you can do some cool things by using the new operators >,<,>=,<=.  This allows you to write queries to see all documents written since the beginning of the month for example.  Your date should be in quotes and make sure there is no space between the keyword and the date itself.

Write>"7/1/2010"

EnterpriseSearchResultsWrite

You can also query by Document Id using the DocId keyword.  Here is an example looking for an item with a Document Id of YY7PPZHWQVY7-5-3.

DocId:"YY7PPZHWQVY7-5-3"

DocumentIdSearchResults

These are all keyword I use on a regular basis.  Remember you can combine most of these together to provide vary narrow search results.  You could also make use of these by writing your own advanced search control.  I hope these queries are useful the next time you use Enterprise Search.  If you can think of any other good ones I left out, please leave a comment.

Comments

# Twitter Trackbacks for Some handy keywords you might find useful in SharePoint Enterprise Search - Corey Roth - DotNetMafia.com - Tip of the Day [dotnetmafia.com] on Topsy.com

Pingback from  Twitter Trackbacks for                 Some handy keywords you might find useful in SharePoint Enterprise Search - Corey Roth - DotNetMafia.com - Tip of the Day         [dotnetmafia.com]        on Topsy.com

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Thursday, February 3, 2011 6:24 AM by René Hézser

Thank you for this list of keyword querys.

René

# Office 365 How to: Add search to your public facing web site with SharePoint Online - Grid User Post

Tuesday, July 26, 2011 12:03 PM by The Grid

The Grid is full of Office 365 experts that are brimming with great information. The Grid User Post blog series will expose some of The Grid&#39;s best content to the entire Office 365 Community. Are you interested in contributing to The Grid? Click here

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Thursday, November 10, 2011 2:03 AM by Daniel

Do you know any keyword to filter by Managed Metadata Keywords?

Daniel

# Sladescross&#039;s Blog

Thursday, November 10, 2011 4:21 AM by Sladescross's Blog

Pingback from  Sladescross&#039;s Blog

# Override Core Results Web Part With Custom Query &laquo; Sladescross&#039;s Blog

Pingback from  Override Core Results Web Part With Custom Query &laquo; Sladescross&#039;s Blog

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Monday, January 16, 2012 7:43 AM by gbelzile

Great list, thanks!

Is there a way to filter by created date instead of modified?

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Monday, April 2, 2012 10:40 PM by CoreyRoth

@gbelzile not that I know of.

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Wednesday, August 29, 2012 5:51 AM by dennish81

I want al documents created by me. Just like a filter action can do with the  [me] n it but than based on search. Do you know any query for this?

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Wednesday, August 29, 2012 1:53 PM by CoreyRoth

@dennish81 I'm afraid there is no shortcut for that.  I have written custom web parts in the past that get the user's name to pass it to the query.  The good news is that you can do that in SharePoint 2013 Preview.  :)

# Getting a list of sites that a user has access to in SharePoint | The SharePoint Doctor

Pingback from  Getting a list of sites that a user has access to in SharePoint | The SharePoint Doctor

# re: Some handy keywords you might find useful in SharePoint Enterprise Search

Wednesday, November 27, 2013 8:15 AM by Stacy Draper

It's all fun and games until the space runs out :)

Leave a Comment

(required)
(required)
(optional)
(required)