Answer Server 12.12

# Question Equivalence Rules

The question equivalence rule provides a general expression to match several equivalent questions. The rule forms part of a question equivalence class. When you ask a question, Answer Server matches the question text against the rules in your question equivalence classes.

In general, you use text with a Boolean or proximity expression to match questions.

For example, the questions Why is the sky blue?, What causes the sky to appear blue?, and What gives the sky the color blue? are all equivalent. You might use the rule `sky NEAR blue` to match all these questions.

You can expand the rules to more complicated expressions to match more complicated sets of equivalent questions. The expression can use the same Boolean and proximity syntax as the IDOL Content component query text, along with bracketed expressions to specify priority. For more information, refer to the IDOL Server Reference.

NOTE: You cannot use Wildcard expressions in your question equivalence rules unless there is also a non-Wildcard term required by the rule. For example, you cannot use the rule `sk*`, because it contains only a Wildcard term. However, you can use `sk* AND blue`, because blue is also required. Answer Server returns an error if you try to use an invalid rule.

In general, Micro Focus recommends that you do not use Wildcard expressions in your rules.

In all these cases, you add the rule to the question equivalence class by using the `ManageResources` action. The `add` and `update` operations for question equivalence classes accept a `rule` property, which accepts the expression as a string value. For example:

    "rule":"sky NEAR blue",

For these rules, you can use the `GetResources` action to suggest rules. See Generate a Question Equivalence Rule. You can also use the `TestRule` action to test whether a rule matches all the questions you want. See Test Your Question Equivalence Rule

For more information about adding a rule to a question equivalence class, see Create a Question Equivalence Class and Add an Answer and Update a Question Equivalence Class.

## Special Rule Types

In certain special cases, you might also want to use a `FieldText` expression. This option is most useful when you have a very short question that you want to match exactly. In this case, you can use a `FieldText` expression to prevent the rule from matching any longer question that contains your short question.

For example, the question What is life? is very short, and might easily match longer questions that are not equivalent, such as What is Life of Pi about?.

When you want to use a `FieldText` expression when you add or update a question equivalence class, you set the `rule` property as an object. This object has a required `text` property, and an optional `fieldtext` property, which set the appropriate text and `FieldText` rules.

The `Ask` action sends the question to your Answer Bank Agenstore in a `DRECONTENT` field. You can use your `FieldText` expression to match text in this field by using the IDOL Content component `FieldText` operators.

For example:

    "rule": { "text": "What is Life?", "fieldtext": "MATCH{What is Life?}:DRECONTENT" }

This rule matches only the exact question What is life?

For more information about `FieldText` operators, refer to the IDOL Server Reference.

NOTE: You must always specify the `text` property. That is, you cannot create a rule with only `FieldText`.

The more complicated rule types can be useful in certain circumstances. However, the `GetResources` rule suggestion option does not return any suggestions that contain `FieldText`. Similarly, you cannot test complex `FieldText` rules by using the `TestRule` action.

© Copyright 2015-2022 Micro Focus or one of its affiliates
Version 12.12 | Last updated June 2022

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL Answer Server 12.12

Topic Title: Question Equivalence Rules