SharePoint 2010 is capable of
executing Boolean operators, suffix wildcards, and property queries in
addition to the standard free text queries. For many end users, simply
being able to execute suffix wildcard searches allows for a much easier
transition to SharePoint from legacy platforms with this functionality.
These capabilities are standard in most global and web site search
engines, but have been lacking in SharePoint until the 2010 suite of
search solutions. The inclusion of more advanced query syntax has
significant impact on a user's ability to expand and narrow a search
result set before using refiners or the Advanced Search page.
Users familiar with
standard search query syntax should be able to easily adopt the
advanced syntax available in SP2010. For those users who do not need to
construct complex queries regularly, and consequently do not wish to
learn the advanced query syntax, most of these options can be found on
the Advanced Search page. It is important to mention that not all query
syntax can be used for free text expressions, keyword queries, and
property restrictions. As each operator is presented, the expressions
that can be used will be noted.
Search Query Operators
The wildcard operator can be used at the end of
a keyword query or property query to enable prefix matching. This
allows a user to broaden a search by entering the initial portion of a
search query and indicating that SharePoint's search engine should fill
in the remainder of the query. In SharePoint 2010, the wildcard
operator is indicated by the asterisk character (“*”). A user can enter
the initial portion of a search term followed by the wildcard operator
as follows.
shar*
The resulting search results may include the
terms SharePoint, sharing, Sharon, sharp, shark, and so on. The
wildcard operator can be used only at the end of each term in a query.
As a result, the query “*point” will search for “point” but not return
“SharePoint”. The search query “Share* AND Exp*” would allow the
wildcard operator to work as expected, since it is inserted at the end
of each term.
SharePoint 2010 supports the AND, OR, NOT, and
NEAR operators, which allow for broadening or narrowing of a search
query. To function as operators, these terms must be entered in all
caps, as shown. The first three Boolean operators can be used with free
text expressions, keyword queries, and property restrictions. The NEAR
operator can be used only with free text expressions. The AND operator
specifies that all of the search terms adjacent to the term “AND” must
be included in the search result. Unless another operator is specified,
the AND operator is entered between all search terms by default when a
query is entered. In this example, both the terms “SharePoint” and
“Expert” must be included in the search result, although the two terms
do not need to be adjacent to each other.
SharePoint AND Expert
The OR operator specifies that a
search result must include one of the terms adjacent to the term “OR”,
but both do not need to be included. In this example, either of the
terms “SharePoint” and “Expert” needs to be included in the search
result, but both do not need to be included.
SharePoint OR Expert
The NOT operator specifies terms that
cannot be included in a search result. Items that contain the keyword
that follows the NOT operator will be excluded from the result. In this
example, results will include the term “SharePoint”, but must not
include the term “Expert”.
SharePoint NOT Expert
The NEAR operator, also referred to as the
proximity operator, specifies that search terms must be in a specific
order and within a close distance to each other. Unlike the AND, OR,
and NOT operators, the NEAR operator can be used only with text
expressions and cannot be used in property restrictions. When placed
between two search terms, only results containing the terms in the
entered order and in close proximity to each other will be returned. If
a user finds that search results being returned with the default AND
operator are irrelevant because term 1 appears on page 1 of a document,
and term 2 appears on page 15 of a document, the
NEAR operator may provide the desired result set. In this example, only
results that include the term “SharePoint” followed by up to eight
other terms and then the term “Expert” will be returned.
SharePoint NEAR Expert
In addition to these Boolean operators, there
are several other operators that are important to know. The first is
the synonym operator that is initiated by the phrase WORDS. The WORDS
operator allows a user to indicate that certain terms in a keyword
query are synonyms of each other. This is similar in function to the OR
operator, in that results need to contain one or more of the keywords,
but these two operators differ in the rankings of the returned results.
Also important to note is that unlike the OR operator, the WORDS
operator is limited to free text expressions and cannot be used on
property restrictions. In the following examples, the keyword query
matches results that contain either the term “Children” or the term
“Kids”.
WORDS (Children, Kids)
Children OR Kids
The results that are returned by using these
two queries may come back in a different order. This is because
standard SharePoint 2010 ranking is being used. When using the WORDS
operator, SharePoint considers the two terms to be the same for ranking
purposes. When using the OR operator, SharePoint considers the two
terms to be different for ranking. For example, if a document contains
the term “Children” five times, and the term “Kids” five times, the
WORDS operator causes that to be considered as ten occurrences of the
same term. If the OR operator is used, SharePoint considers the
document to have five occurrences of the term “Children” and five
occurrences of the term “Kids”. As a result, SharePoint would place the
document with the assumed ten occurrences of one term earlier in the
result set than five occurrences of each term.
Identical to the AND/NOT operators, SharePoint
can accept the inclusion and exclusion operators. These are established
by insertion of a + or − in the query, and can be used on free text
search or property restrictions. Since it is identical to the AND
operator, the inclusion (+) operator is the default behavior of search
unless another operator is specified. In the following example, content
containing the terms SharePoint and Expert is included in the search
results, but content that contains the term MOSS is not.
SharePoint + Expert – MOSS
Quotation marks (“”) can be entered around a
phrase to specify that search results must contain the exact set of
words in the provided order. This allows for phrases to be grouped
together and considered as one search term. This is necessary when the
terms need to be in a specific order without additional terms between
them. If quotation marks are not used, the AND operator will be
inserted between terms by default. This may cause results to be
returned where keywords have many other terms separating them. Unlike
the NEAR operator, which will return all the results produced by using
quotation marks, the exact phrase operator returns only results where
the terms are touching. The NEAR operator will return results where the
terms are either touching or in close proximity to each other. In the
following example, only results containing the phrase “SharePoint 2010
Expert” will be returned.
"SharePoint 2010 Expert"
Parentheses “( )” can be
entered to combine parts of keyword queries. Just like a math equation,
entering keywords between parentheses will allow terms or phrases to be
grouped together. In the following example, all results will include
the term SharePoint, but they must also include either the term
“Expert” or “Genius”.
(Expert OR Genius) AND SharePoint