Share via


NEAR Term in Windows SharePoint Services Search SQL Syntax

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.

Specifies that two content search terms must be located relatively close to one another to be recognized as matching by the CONTAINS predicate.

<content_search_term> NEAR | ~ <content_search_term>

Remarks

The NEAR term can be represented by the keyword NEAR or by a tilde (~).

When the words in the query joined by NEAR are found within approximately 50 words of one another in the column that is being searched, the NEAR term returns a match. The closer together the two words are, the higher the calculated rank for the NEAR term. The farther apart the two words are, the lower the rank.

Note The number of words is approximate; it can be less than 50. If the match words specified with the NEAR term are both found in the column being searched, but are farther apart than 50, the result is still returned but has a rank of 0.

The following table describes content search term types that can be used with a NEAR term in a CONTAINS predicate.

Type

Description

Examples

Word

A single word without spaces or other punctuation. Double quotation marks are not necessary.

…WHERECONTAINS('computer

NEAR software)')

Phrase

Multiple words or included spaces.

…WHERECONTAINS('"computer software" NEAR hardware)')

Wildcard

Words or phrases with the asterisk (*) added to the end. For more information, see Using Wildcards in the CONTAINS Predicate in Windows SharePoint Services Search SQL Syntax.

…WHERECONTAINS('"compu*" NEAR "soft*"')

Examples

The following example shows how you can chain NEAR terms, using both the short and long forms of the term.

…WHERE CONTAINS('computer NEAR software ~ "setup application"')

See Also

Reference

CONTAINS Predicate in Windows SharePoint Services Search SQL Syntax