The 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.
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 valid property restriction both preceding and following the and operator.
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 valid property restriction following the not expression. This is functionally the same as using the minus ("-") character.
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.
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.
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.
Inclusion and Exclusion Operators
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.
Includes content with values that match the inclusion. This is the default behavior if no character is specified.
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.