Share via


Windows SharePoint Services Search Keyword Syntax Inclusion and Exclusion

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

When you specify the property filter in Windows SharePoint Services Search keyword syntax, you must also specify whether the results returned should include or exclude content that matches the value specified for that property filter. You accomplish this using Windows SharePoint Services Search keyword syntax inclusion and exclusion characters.

Inclusion and Exclusion Characters

The following table describes the keyword syntax inclusion and exclusion characters.

Name

Character

Behavior

Inclusion

"+"

Include content with values that match the inclusion.

Exclusion

"-"

Exclude content with values that match the exclusion.

Remarks

By definition, property filters are included, so you do not need to use the inclusion character "+". If you do include the character with a property filter, it is ignored. For example, the following syntax fragments behave similarly:

author:"John Smith"
+author:"John Smith"

You can use the exclusion character with a property filter to exclude results from search. This is equivalent to the NOT operator in SQL search syntax. The following syntax fragment shows the use of this character with a property filter:

-author:"John Smith"

Note The search query must contain at least one included keyword or property filter. If the query contains only an exclusion, it fails with a Microsoft.SharePoint.Search.Query.QueryContainsOnlyExcludedTermsExceptionexception.

See Also

Reference

Microsoft.SharePoint.Search.Query.KeywordQuery

Windows SharePoint Services Search Keyword Syntax