Add Rules

Putting new rules will replace all existing rules associated with the specified filter_name and filter_value if there are any.

curl -X PUT -H "Content-Type: application/json" \
-d '{
"slot_rules": [
{
"rule": {
"item_id": "fiddos_food_item",
"position": 1
},
"active": true,
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
]
}' \
-u"[your token]:" "https://ac.cnstrc.com/refined_filters/group_id/dog%20food?key=[your index key]&section=Products"
info

The above command returns a 204 Success response on success. For simplicity sake, a 204 Success response will be returned even if the item already exists.

HTTP Request#

PUT https://ac.cnstrc.com/refined_filters/[filter_name]/[filter_value]?key=[your index key]&section=[section]

URL Parameters#

ParameterDescription
filter_nameThe name of facet you'd like to add searchandizing rules for.
filter_valueThe value of that facet you'd like to add searchandizing rules for.
sectionYesThe index section you'd like to retrieve results from (typically Products).

JSON Specifications#

Example JSON
{
"slot_rules": [
{
"rule": {
"item_id": "fiddos_food_item",
"position": 1
},
"active": true,
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
],
"whitelist_rule": {
"rule": {
"filters": { "brand": ["fiddos food"] }
},
"end_time": "2018-06-28 01:34:08"
},
"blacklist_rules": [
{
"rule": {
"filters": { "type": ["toys"] }
},
"start_time": "2018-06-28 01:34:08",
"end_time": "2018-06-30 01:34:08"
}
],
"boost_rules": [
{
"rule": {
"filters": { "color": ["red"] },
"boost": 0.5
}
}
]
}

Types of rules#

idDescription
slot_rulesWith slot rules, you can add an item to recall and pin it to a particular position. Provide item_id and a particular position for the item(s).
boost_rulesBoost or bury the score (and in turn, ranking) of matching items.
whitelist_ruleRestrict recall to only the matching items.
blacklist_rulesRemove matching items from recall.

Parameters#

ParameterRequired?Description
ruleYesRules can accept a dictionary of the various rule specs as show in the above JSON example.
activeNoYour slot rule can be defined but set to inactive if you wish by setting the active field to false.
start_timeNoStart time when the searchandizing rule should be enabled.
end_timeNoEnd time when the searchandizing rule should be disabled.