This API allows you to update a facet in Hawksearch dashboard and manage the facet configurations.
Example use case: Add a display rule for the Price facet so that it is only visible when Brand is ‘Columbia Sportswear’.
...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <Rule xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RuleType="Group" Operator="All"> <Rules> <Rule RuleType="Eval" Operator="None"> <Rules /> <Field>facet:brand</Field> <Condition>is</Condition> <Value>Columbia Sportswear</Value> </Rule> <Rule RuleType="Eval" Operator="None"> <Field>facet:subdepartment</Field> <Condition>is</Condition> <Value>Socks</Value> </Rule> <Rule RuleType="Eval" Operator="None"> <Rules /> <Field>keyword:Keyword</Field> <Condition>contains</Condition> <Value>sock</Value> </Rule> </Rules> <Field /> <Condition /> <Value /> </Rule> |
Rules node
Attributes:
RuleType attribute specifies if the rule must be processed for a result or treated as a group with rules nested inside it. If the rules node contains further rules, then the type must be set to “Group” for that rules node. For rules that need to be evaluated, please set this attribute to “Eval.”
Operator attribute specifies what the condition is for evaluation for rules with in a group. If all rules in the group need to be met to satisfy the group the value must be set to “All”. If at least one rule needs to be satisfied, please set the value to “Any”. For nested rules (not the parent rules node), if there is only one rule inside the group please set value to “None”.
Child Nodes:
Field: Specify the field name you want to use as part of condition
Condition: Specify the condition (is equal to, contains) so on
Value: This is the value to compare against