Taxonomy Rules: Operator Reference

Operators

Use the following table to see an overview of the available rule operators and their functions.

More information is available in the following sections:

Type Operator
Boolean
  • Use Boolean operators to broaden or narrow your search.

  • Use these operators to modify free text expressions and property restrictions in KQL queries.

  • You can specify multiple Boolean operators in your rules.

This statement is true whether you specify multiple instances of the same Boolean operator such as AND or OR, or whether you choose to specify a combination of these operators in a single rule.

  • AND: Match both of these terms.

  • OR: Match either of these terms.

  • NOT: No match is returned for a document that contains this term.

AND can also be chained with NOT where both operators are separated by a space: AND NOT.

The NOT (and the AND NOT) operator is not compatible with the SIMPLE RULE DEVELOPMENT pane.

Specify this operator using the FINE TUNE RULEs pane, only

A NOT example: The following expression returns a match on input documents that contain the term prerequisites and not the term autoclassifier.

"prerequisites" NOT "AutoClassifier"

For more examples, see "Examples to Boost Matching Scores," below.

CASE Matches the exact case of the input term.

Use the CASE operator to match the exact case of every letter in the term. When you specify the CASE operator, you limit the matches on input documents to those documents that contain one or more terms with an exact match on the specified case.

For example, to return a match on "prerequisites," but not Prerequisites or PreRequisites, specify:

CASE("prerequisites")

NOSTEM

Use the NOSTEM operator when you want to return an exact match on a term, but no matches on the various forms of the term.

For example, to return a match on pre, but not prerequisites, specify:

NOSTEM("pre")

Proximity (NEAR)

NEAR: Matches only within the specified proximity.

  • The NEAR operator matches input documents when the specified search terms are within close proximity to each other.

  • There is no ordering requirement for matching.

Note: The NEAR operator is not compatible with the SIMPLE RULE DEVELOPMENT pane.
Specify this operator using the FINE TUNE RULEs pane, only.

By default, the NEAR operator specifies the maximum distance of eight terms.

SOUNDSLIKE

Use the SOUNDSLIKE operator when you want to return matches for terms with an inexact spelling match. In this case, make sure that you specify letter(s) that are pronounced similarly to the letters in the word that you want to match.

For example, to return a match on prerequisites, you can specify:

SOUNDLIKE("prerech")

Wildcard

*: Matches words with the specified suffix or prefix.

Do not enclose a term and the modifying wildcard in parentheses (()).
  • The wildcard operator (*) lets you match a number of words that begin or end with the specified sequence of characters.

  • Use this operator when you want to match a number of terms including terms that you might not know about.

Notes

Do not use quotation marks ("") to surround your term when you specify a wildcard.
You can use parentheses (()), but parentheses are optional and not required.

  • When the wildcard operator is appended to a prefix, all of the words that begin with the specified string are matched.

For example, to match litigate, litigation, litigious, litig, and litigating, specify:

litig*

  • When the wildcard operator precedes a string or suffix, all of the words that end with the specified string are matched.

For example, to match framework, network, or homework, specify:

*work

Regular expressions Use with or without special characters such as +, ?, *, and so on. For more information, see Regular Expressions.
KQLAR syntax

Use with operators such as AND, OR, and NOT.

For more information, see Key Word Query Language Syntax.

Note: KQLAR is the specific variation of KQL operators used by AutoClassifier

Note: You can customize your rules to be applicable on a specific field by using FieldName:({Your Complex Rule}) syntax.
Example: Title:(Term1 near(5) Term2).

Examples to Boost Matching Scores

public void BoostScoreForRule(float addToScore, string propertyName, RuleType ruleType, LabelMatchType lableMatchType, int hitCountThreshold)

The specified value is added to the final score if there is a match for the specified rule types TermMatch or NearMatch, and label types Primary or Synonym, the number of hits in the specified field is equal or greater than the hit count threshold provided as the parameter.

For example:

  • Context.BoostScoreForRule(0.5F, "title", RuleType.TermMatch, LabelMatchType.Primary, 1);

Adds 0.5 to the final score if there is at least one hit on the primary term label in the title of the document.

  • Context.BoostScoreForRule(0.3F, "body", RuleType.TermMatch, LabelMatchType.Synonym, 5);

Adds 0.3 to the final score if there are at least five hits for any of the term synonym labels.

  • var allLabelTypes = LabelMatchType.Primary | LabelMatchType.Synonym ; Context.BoostScoreForRule(0.2F, "body", RuleType.NearMatch, allLabelTypes, 8);

Adds 0.2 to the final score if there are at least eight total hits of the NEAR subqueries configured in the term rule taking into consideration both primary and synonym labels.

  • public void BoostScoreForRule(float addToScore, string propertyName, LabelMatchType lableMatchType, int hitCountThreshold, int nearProximity)

Adds the specified value to the final score.

This statement is true if in the specified field, for the specified NEAR query proximity and label type (Primary or Synonym), the number of hits is equal to, or greater than, the hit count threshold that is specified as the parameter.

  • Context.BoostScoreForRule(0.3F, "body", LabelMatchType.Primary, 2, 3);

Adds 0.3 to the final score if there are at least two hits of the proximity 3 NEAR subquery containing the Primary term label.

How to Group Terms

Use parentheses "()" to group terms, using the AND or OR Boolean operators, to specify the ordering of the operations that are enclosed by the parentheses.

The following rule example uses parentheses and also relies on the built-tin AutoClassifier stemming feature in order to locate matches in the input documents:

See an example of parentheses in a rule.