Searching with Property Filters

This blog posting applies to Microsoft Office SharePoint Server 2007.

SharePoint can search for content using the values in site columns, as well as performing free text searches. The official help page that describes this is at https://msdn2.microsoft.com/en-us/library/ms476494.aspx. This posting gives some more examples of ways in which this is useful.

The names of the property filters you can use are the names of the columns on your document library or content type. One of the most useful property filters is ContentType, because with this you can search for specific types of documents; many values can be specified. There are a hierarchy of content types available, and specifying one will include all of its descendants. Here is a partial tree of the most pertinent values you can use for ContentType:

Page

                Article Page

                Welcome Page

Item

                Document

                Picture

                Report

                Custom document types

                Announcement

                Contact

                Event

                Issue

                Link

                Task

                Folder

                                Discussion

 

Examples; Unions and Intersections

Search syntax does not provide Boolean operators AND & OR. But very similar functionality can be gained with the right combinations of properties. When one property is specified several times, all of the conditions are combined using OR. When different properties are specified, all of the conditions are combined using AND.

ContentType:"Announcement" ContentType:"Event"

Every list item that’s an Announcement OR an Event

ContentType:"Document"

All documents

ContentType:"Document" Author:"Mark Arend" Status:"Not Started" Status:"Draft"

All Documents created by Mark Arend that have a status of Not Started OR Draft

ContentType:"Article Page" -Status:"Published"

All Article Pages that are NOT Published. note the dash character to negate a property filter.

Other Filters

Property filters provide you with a way to narrow the focus of the keyword search based on the following:

  • Managed properties <property name>:<value>
  • Scopes <scope name>:<value>
  • Collapsed results <collapsed results type>:<value>

There is no maximum length for keywords property filters, however, the full length of the keyword query should be less than 1024 characters.

Keyword syntax supports querying for any properties of a string or numeric type from the full set of managed properties.

Name

Description

Examples

site

The URL property. Note:

  • If a URL folder name contains a space, it must be enclosed in double quotation marks ("…").
  • Do not end a URL folder name with a trailing slash ("/").

site:https://employeesstg.amr.

scope

Compound scope. Specify the friendly name of scope.

scope:"Marketing Content"

duplicate

Collapsing filter. Requests duplicate items for specified URL.

duplicate:https://<displayUrl>

 

If there are one or more spaces in the display name of the column you want to filter by, then you must use the internal name of the column instead. Usually, this means replacing all spaces in the name with _x0020_. For example, to filter on Issue Status, use Issue_x0020_Status. Sometimes the space is just removed; for example, to filter on Contact Type, use ContactType. In some cases neither rule applies and the internal name is different; use a tool such as an object model browser such as SharePoint Inspector (https://www.codeplex.com/spi) to find the internal name (called the Static Name) that you need to use. Here are a few common ones:

Display Name

Static (internal) Name

Approval Status

ModerationStatus

Approver Comments

ModerationComments

Article Date

ArticleStartDate

Checked Out To

CheckoutUser

Collect Feedback

CollectF

Collect Signatures

CollectS

Contact E-Mail Address

PublishingContactEmail

Contact Name

PublishingContactName

Contact Picture

PublishingContactPicture

Content Type

ContentType

Created

Created_x0020_Date

Encoded Absolute URL

EncodedAbsUrl

Image Caption

PublishingImageCaption

Modified

Last_x0020_Modified

Page Content

PublishingPageContent

Page Image

PublishingPageImage

Page Layout

PublishingPageLayout

Path

FileDirRef

Rollup Image

PublishingRollupImage

Scheduling End Date

PublishingEndDate

Scheduling Start Date

PublishingStartDate

Server Relative URL

ServerUrl

Target Audiences

Audience

URL Path

FileRef

Comments

  • Anonymous
    October 25, 2006
    Thanks for the extra info on the property filters.  I've been trying to search a site with a url that has a folder containing spaces.  I've tried the double quotes around the url -- site:"http://server/documents/folder one" but I get no results.  I've run the same code with a url containing no spaces and results come back as expected.  Just curious if you have been able to accomplish this.