2012-08-26, 16:55
(2012-08-26, 16:46)Mizaki Wrote:Code:{ "filter": {
"and":
[
{ "or":
[
{ "and":
[
{"field": "title", "operator": "startswith", "value": "v"},
{"field": "title", "operator": "endswith", "value": "d"}
]
}
]
},
{"field": "genre", "operator": "is", "value": "drama"},
{"field": "genre", "operator": "is", "value": "comedy"}
]
}
}
From a logical point of view this means :
I want :
- Genre is drama
And
- Genre is comedy
And
(Here you put an or with only one choice so is an and)
And
- Title start with v
And
- Title end with d
This :
Quote:Title starts with "v" and ends with "d"
or
Genre is "drama" or "comedy"
Should be written
Code:
{ "filter": {
"or":
[
{ "and":
[
{"field": "title", "operator": "startswith", "value": "v"},
{"field": "title", "operator": "endswith", "value": "d"}
]
},
{ "or":
[
{"field": "genre", "operator": "is", "value": "drama"},
{"field": "genre", "operator": "is", "value": "comedy"}
]
},
]
}
}