Function Rule
Description:
Using the Expression Builder, users can construct rules that will alter the way the search engine searches and displays the results. Expression Builder can help users to fine tune the way they want the results to appear when a search is conducted. There are two different type of rules a user can create, Sorting Function Rule and a Regular Function Rule.
How do I add a Sort Function / Regular Function Rule?
- Click and open the relevancy model to which you want to add a Sort/Function Rule Term. Make sure this model is in the Draft or Benchmarked state.
- Click on the Sort Function / Regular Function Rule label inside the model. On the right-hand side it should display all the Function Rules that have already been set.
- Locate a circular (+) button and click on it, and this will bring up a menu. Here you can choose to create a new Sort Function, regular function or a function rule with the help of a template. Clicking on any of these options will bring up the popup with the Expression Builder.
- Here you can enter the basic information, execution triggers and execution configurations. The options within these categories will change depending on the type of function rule you are creating. Refer the Expression Builder documentation for further help on how to build expressions.
- Click on Save to save the rule
Refer below screenshot to add function rule.
How do I edit a Function Rule?
- Click and open the relevancy model from which you want to edit a Function Rule. Make sure this model is in the Draft or Benchmarked state.
- Click on the Function Rules label inside the model. On the right-hand side it should display all the Sort Function / Regular Function Rules that have already been set.
- Under the Actions column, there will be a Pencil icon. Clicking on it will bring up the same popup you used while creating the rule. Here you can make the necessary changes and then click on Save.
- If the save is successful, the edited text will remain in black color. However if the text color changes to red, then there is an error. Refresh the page and check if the rules already exists exist within that model.
What are Execution Configurations?
Execution Configurations are a set of options that dictate how the function rule will behave
- Precedence: This option lets the user control the order of execution of the rules. The function rule with the highest precedence will execute first, followed by the next highest precedence value. This continues down the line till the last function rule.
- Function Type (Function Rule only): There are two types here, Multiplicative and Additive. Each rule has a score that is calculated based on each document. This score can either be added or multiplied to the score of the document. The Multiplicative option will multiply the score of the function rule to the score of the document, thus having a higher impact than that of the Additive option.
- Sort Order (Sorting Function only): This option lets the user decide if they want the documents to be sorted in ascending or descending order based on the sorting function’s score only.
- Grouping: This option does not affect the relevancy or score of documents. It's purely provided for the user to be able to group rules in a more logical fashion. If no value is given, then all rules are grouped under a common "General" category.
What are Execution Triggers?
Besides the rule being active, the user can specify conditions where the rule can be triggered during query time.
- Trigger Expressions: The user can add an expression, which when evaluated during query time to be true, will trigger the rule to be activated.
- Trigger Tokens: A list of search tokens that can trigger the rule to be activated if they are a part of the search query.
- Query Parameters: This list of parameters is generated by the system from the function expression that is created by the user. This is a non-editable field.
What are Function Templates?
Function Templates are just like regular function rules, except for the fact that they have been saved as a template. Templates can be used to save a more complex function rule as an outline. This outline can later be used to create rules more easily, without having to recreate them from scratch.
How to create Function Templates?
Creating a function Template is exactly like creating a function rule, except for the fact that while saving the rule you click on the button Save as Template. Then in the Create Function rule drop-down, the newly created template will be added.
What are Expression Macros?
While creating a function, the user might find it beneficial to use a function rule within another function rule. This can be done with the help of Expression Macros. After creating and saving a function, it will be available to be used as part of another function. The newly created function will be part of the drop-down list in the expression builder under the sub-heading 'Expression Macros'. While saving the function rule, if the expression contains macros, the expression macros are replaced by their accompanying expressions.
How do I delete a Function Rule?
- Click and open the relevancy model from which you want to delete a Function Rule. Make sure this model is in the Draft or Benchmarked state.
- Click on the Function Rules label inside the model. On the right-hand side it should display all the Sort Function / Regular Function Rules that have already been set.
- Under the Actions column, there will be a Trash icon. Clicking on it will delete the rule.