Share via


Property Restriction Keyword Queries

Applies to: SharePoint Server 2010

Using the SharePoint Enterprise Search keyword syntax in SharePoint Server 2010, you can construct queries that use property restrictions to narrow the focus of the query to match only results based on a specified condition.

Specifying Property Restrictions

A basic property restriction consists of the following:

<Property Name><Property Operator><Property Value>

Following are some examples of valid keyword syntax property restrictions:

author :"John Smith"

Returns content items authored by John Smith.

filetype:docx

Returns Microsoft Word documents.

filename:budget.xlsx

Returns content items with the file name budget.xlsx.

The property restriction must not include white space between the property name, property operator, and the property value, or the property restriction will be treated as a free-text query. The length of a property restriction is limited to 2,048 characters.

In the following examples, because of the white space the query returns content items containing the terms "author" and "John Smith", instead of content items authored by John Smith:

author: "John Smith"

author :"John Smith"

author : "John Smith"

This is equivalent to the following example:

author "John Smith"

Property Names

You must specify a valid managed property name for the property restriction. By default, SharePoint Enterprise Search includes several managed properties for documents.

To specify a property restriction for a crawled property value, you must first map the crawled property to a managed property. For more information, see the "Managed and Crawled Properties" section in Plan the end-user search experience.

One of the following managed property settings must be true:

  • Retrievable, which stores the property value in the Property Store database.

  • FullTextQueriable, which stores the property value in the full-text index.

Property Operators

SharePoint Enterprise Search supports several new property operators. Table 1 lists valid property operators you can use in property restrictions.

Table 1. Valid property operators for property restrictions

Operator

Description

Supported Managed Property Type

:

Returns results where the value specified in the property restriction is equal to the property value that is stored in the Property Store database, or matches individual terms in the property value that is stored in the full-text index.

=

Returns search results where the property value is equal to the value specified in the property restriction.

  • Text

  • DateTime

  • Integer

  • Decimal

<

Returns results where the property value is less than the value specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

>

Returns search results where the property value is greater than the value specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

<=

Returns search results where the property value is less than or equal to the value specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

>=

Returns search results where the property value is greater than or equal to the value specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

<>

Returns search results where the property value does not equal the value specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

..

Returns search results where the property value falls within the range specified in the property restriction.

  • DateTime

  • Integer

  • Decimal

Property Values

You must specify a property value that is a valid data type for the managed property's type. The following table lists these type mappings.

Table 2. Valid data type mappings

Managed Type

Data Type

Text

String

Integer

Int32

Decimal

Decimal

DateTime

DateTime

YesNo

Boolean

Binary

Byte

Text Values

For text property values, the matching behavior depends on whether the property is stored in the full-text index or in the Property Store database.

Property Values in the Full-Text Index

Property values are stored in the full-text index when the FullTextQueriable property is set to true for a managed property. You can configure this only for string properties. Property values that are specified in the query are matched against individual terms in the property value that is stored in the full-text index.

For example, if you are searching for a content item authored by Paul Shakespear, the following keyword query returns matching results:

author:Shakespear
author:Paul

Prefix matching is also supported. You can use the wildcard operator (*), but it is not required when you specify individual words. Continuing with the previous example, the following keyword queries return content items authored by Paul Shakespear as matches.

author:Shakesp


author:Shakesp*

When you specify a phrase for the property value, matched results must contain the specified phrase within the property value that is stored in the full-text index. The following query example returns content items with the text "Advanced Search" in the title, such as "Advanced Search XML", "Learning About the Advanced Search Web Part", and so on:

title:"Advanced Search"

Prefix matching is also supported with phrases specified in property values, but you must use the wildcard operator (*) in the query, and it is supported only at the end of the phrase, as follows:

title:"Advanced Sear*"

The following queries do not return the expected results:

title:"Advan* Search"
title:"Advanced Sear"

Properties Values in the Property Store Database

Property values are stored in the Property Store database when the Retrievable property is set to true for a managed property. You can configure this setting for any managed property type. Property values specified in the query are matched against the entire value of the property. For example, using a managed property named company, configured with the Retrievable property set to true and the FullTextQueriable set to false, the following keyword query matches content items where the company is Adventure Works:

company:"Adventure Works"

The following queries would not return these content items in the results:

company:Adventure
company:Works
company:"Adventure W*"

Numerical Values

For numerical property values, which include the Integer, Decimal, Binary, and YesNo managed types, the property restriction is matched against the entire value of the property. The following example matches content items with the size of 100 KB:

size:100KB

The following keyword query examples would not match these content items:

size:10
size:10*

Multiple Property Restrictions

SharePoint Enterprise Search supports the use of multiple property restrictions within the same keyword query. You can use either the same property for more than one property restriction, or a different property for each property restriction.

When you use multiple instances of the same property restriction, matches are based on the union of the property restrictions in the keyword query. Matches would include content items authored by John Smith or Jane Smith, as follows:

author:"John Smith" author:"Jane Smith"

This is functionally the same as using the OR Boolean operator, as follows:

author:"John Smith" OR author:"Jane Smith"

When you use different property restrictions, matches are based on an intersection of the property restrictions in the keyword query, as follows:

author:"John Smith" filetype:docx

.Matches would include Microsoft Word 2010 documents authored by John Smith. This is functionally the same as using the AND Boolean operator, as follows:

author:"John Smith" AND filetype:docx

See Also

Concepts

Keyword Query Syntax Reference

Free-Text Keyword Queries

Using Operators in Keyword Queries