Export (0) Print
Expand All

Using Operators in Keyword Queries

SharePoint 2010

Last modified: August 01, 2011

Applies to: SharePoint Server 2010

In this article
Boolean Operators
Proximity Operators
Synonym Operators
Wildcard Operator
Inclusion and Exclusion Operators
Parenthesis
Property Restrictions

The SharePoint Enterprise Search keyword query syntax includes several operators that you can use to construct complex queries.

You use Boolean operators to broaden or narrow your search. You can use Boolean operators with free text expressions and property restrictions in keyword queries. The following table lists the supported Boolean operators.

Table 1. Boolean operators supported in keyword query syntax

Operator

Description

AND

Returns search results that include all of the free text expressions, or property restrictions specified with the AND. You must specify a valid free text expression and/or a valid property restriction both preceding and following the AND operator.

NOT

Returns search results that do not include the specified free text expressions or property restrictions. You must specify a valid free text expression and/or a valid property restriction following the NOT operator. This is functionally the same as using the minus ("–") character.

OR

Returns search results that include one or more of the specified free text expressions or property restrictions. You must specify a valid free text expression and/or a valid property restriction both preceding and following the OR operator.

You use the NEAR operator to match results where the specified search terms are within close proximity to each other. You can use the NEAR operator with free text expressions only; it is not supported with property restrictions in keyword queries and with phrase queries.

The following keyword query example returns results where an instance of the term "federated" is followed by up to eight other terms, and then an instance of the term "search".

Federated NEAR Search 

The order of the terms in the keyword query is respected, so the previous query example will only match when the term "federated" is followed by the term "search". In this example, no match is made when the instance of the term "search" is found before the instance of the term "federated".

You use the WORDS operator to specify that the terms in the keyword query are synonyms, and that results returned should match either of the specified terms. You can use the WORDS operator with free text expressions only; it is not supported with property restrictions in keyword queries.

The following keyword query example matches results that contain either the term "TV" or the term "television". This matching behavior is the same as if you had used the following query.

WORDS(TV, Television)
TV OR Television

These keyword queries differ in how the results are ranked. When you use the WORDS operator, the terms "TV" and "television" are treated as synonyms instead of separate terms. Therefore, instances of either term are ranked as if they were the same term. For example, a content item that contained one instance of the term "television" and five instances of the term "TV" would be ranked the same as a content item with six instances of the term "TV".

You use the wildcard operator—the asterisk character ("*")—to enable prefix matching. You can specify part of a word, from the beginning of the word, followed by the wildcard operator, in your keyword query, as follows.

serv*

This keyword query would match results that include terms beginning with "serv", followed by zero or more characters, such as serve, server, service, and so on.

You can specify whether the results that are returned should include or exclude content that matches the value specified in the free text expression or the property restriction by using the inclusion and exclusion operators, described in the following table.

Table 2. Operators for including and excluding content in results

Name

Operator

Behavior

Inclusion

"+"

Includes content with values that match the inclusion.

This is the default behavior if no character is specified.

Exclusion

"-"

Excludes content with values that match the exclusion.

You can combine different parts of a keyword query by using the opening parenthesis character "(" and closing parenthesis character ")". Each opening parenthesis "(", must have a matching closing parenthesis ")". White space preceding or following parenthesis does not affect the query.

You use property operators in property restrictions to match specific property values. For more information about property restrictions, including the list of property operators supported by the keyword syntax, see Property Restriction Keyword Queries.

Show:
© 2014 Microsoft