Metadata Filter
Results of visually similar product recommendations could be filtered based on the product metadata. For information that can be used as a filter, refer to Product Metadata.
Metadata Filter Request
- Set as a key-value style JSON object within
metadataFilterfield in the request body. - A condition consists of an operator and a value.
- If two or more operators are included, it is recognized as an AND condition.
Example
"metadataFilter": {
"productName" : { "in" : ["skirt", "pants"] },
"originPrice" : {
"ge": 10,
"le" : 100,
},
"tag":{
"in" : "#산뜻한"
}
}
Operators
The available operators are as follows: there are restrictions on the types that can be used for each operator.
| Operator | Meaning | String Type | Number Type | Date Type |
|---|---|---|---|---|
| eq | = | O | O | O |
| ne | != | O | O | O |
| ge | >= | X | O | O |
| gt | > | X | O | O |
| le | <= | X | O | O |
| lt | < | X | O | O |
| in | in (inclusive relationship) | O | O | O |
| like | similar relationship | O | X | X |
eq (=)
Example: products that productName is skirt
query string (GET Method)
body (POST Method)
"metadataFilter": {
"productName" : { "eq" : "skirt" }
}
ne ( )
Example: products that productName is not skirt
query string (GET Method)
body (POST Method)
"metadataFilter": {
"productName" : { "ne" : "skirt" }
}
ge (≥)
Example: Products that originPrice is greater or equal than 100
query string (GET Method)
body (POST Method)
"metadataFilter": {
"originPrice" : { "ge" : 100 }
}
gt (>)
Example: Products that originPrice is greater than 100
query string (GET Method)
body (POST Method)
"metadataFilter":{
"originPrice" : { "gt" : 100 }
}
le (≤)
Example: Products that originPrice is less or equal than 100
query string (GET Method)
body (POST Method)
"metadataFilter": {
"originPrice" : { "le" : 100 }
}
lt (<)
Example: Products that originPrice is less than 100
query string (GET Method)
body (POST Method)
"metadataFilter": {
"originPrice" : { "lt" : 100 }
}
in
Example: Products that productName is skirt or pants
query string (GET Method)
body (POST Method)
"metadataFilter": {
"productName" : { "in" : ["skirt", "pants"] }
}
like
Example: Products that productName contains skirt
query string (GET Method)
body (POST Method)
"metadataFilter": {
"productName" : { "like" : "skirt" }
}
More Complex Example
Example: Products that productName is skirt or pants, originPrice is 10 or more and 100 or less, and tag contains #fresh
query string
body
"metadataFilter": {
"productName" : { "in" : ["skirt", "pants"] },
"originPrice" : {
"ge": 10,
"le" : 100,
},
"tag":{
"in" : "#fresh"
}
}