1
2
3
4
5
6
7
8
9
10
11
12
13
14
| $rule = array(
'objectID' => 'rule_with_filterPromotes',
'conditions' => array(array(
'pattern' => '{facet:brand}',
'anchoring' => 'is'
)),
'consequence' => array(
'filterPromotes' => true,
'promote' => array(
'objectID' => 'promoted_items',
'position' => 0
)
)
);
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| rule = {
objectID: 'rule_with_filterPromotes',
conditions: [{
pattern: '{facet:brand}',
anchoring: 'is'
}],
consequence: {
filterPromotes: true,
promote: {
objectID: 'promoted_items',
position: 0
}
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| const rule = {
objectID: 'rule_with_filterPromotes',
conditions: [{
pattern: '{facet:brand}',
anchoring: 'is'
}],
consequence: {
filterPromotes: true,
promote: {
objectID: 'promoted_items',
position: 0
}
}
};
|
1
2
3
4
5
6
7
8
9
10
11
12
13
| rule = {
'objectID': 'rule_with_filterPromotes',
'conditions': [{
'anchoring': 'is',
'pattern': '{facet:brand}',
}],
'consequence': {
'filterPromotes': True,
'promote': [
{'objectID': 'promoted_items', 'position': 0},
],
},
}
|
1
2
3
4
5
6
7
8
9
| let rule = Rule(objectID: "rule_with_filterPromotes")
.set(\.conditions, to: [
Rule.Condition()
.set(\.anchoring, to: .is)
.set(\.pattern, to: .facet("brand"))
])
.set(\.consequence, to: Rule.Consequence()
.set(\.filterPromotes, to: true)
.set(\.promote, to: [.init(objectID: "promoted_items", position: 0)]))
|
1
| // filterPromotes is not implemented in Android.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| var rule = new Rule
{
ObjectID = "rule_with_filterPromotes",
Conditions = new List<Condition>
{
new Condition { Anchoring = "is", Pattern = "{facet:brand}" },
},
Consequence = new Consequence
{
FilterPromotes = true,
Promote = new List<ConsequencePromote>
{
new ConsequencePromote {ObjectID = "promoted_items", Position = 0}
}
}
};
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| Condition condition = new Condition().setAnchoring("is").setPattern("{facet:brand}");
Consequence consequence =
new Consequence()
.setFilterPromotes(true)
.setPromote(
Collections.singletonList(
new ConsequencePromote().setObjectID("promoted_items").setPosition(0)));
Rule rule =
new Rule()
.setObjectID("rule_with_filterPromotes")
.setConditions(Collections.singletonList(condition))
.setConsequence(consequence);
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| rule := search.Rule{
ObjectID: "rule_with_filterPromotes",
Conditions: []search.RuleCondition{
{
Anchoring: search.Is,
Pattern: "{facet:brand}",
},
},
Consequence: search.RuleConsequence{
FilterPromotes: opt.FilterPromotes(true),
Promote: []search.PromotedObject{
{ObjectID: "promoted_items", Position: 0},
},
},
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| val rule = Rule(
objectID = "rule_with_filterPromotes",
conditions = Some(
Seq(
Condition(
pattern = "{facet:brand}",
anchoring = "is"
)
)
),
consequence = Consequence(
filterPromotes = Some(true),
promote = Some(Seq(ConsequencePromote("promoted_items",0)))
)
)
|
1
2
3
4
5
6
7
8
9
10
| val rule = Rule(
objectID = ObjectID("rule_with_filterPromotes"),
conditions = listOf(Condition(Anchoring.Is, Pattern.Facet(Attribute("brand")))),
consequence = Consequence(
filterPromotes = true,
promote = listOf(
Promotion(ObjectID("promoted_items"), position = 0)
)
)
)
|