要只找到主要是酒吧的地方(不是有酒吧的餐馆),你应该使用
includedPrimaryTypes
而不是
includedTypes
。原因如下:
-
包含类型
匹配主要和次要类型,因此它将返回任何在任一类别中都有“bar”的位置
-
包括主要类型
仅与主类型匹配,因此它将仅返回“bar”为主分类的位置
以下是更正后的查询:
json
{
"insights": ["INSIGHT_COUNT"],
"filter": {
"locationFilter": {
"region": {
"place": "places/ChIJIQBpAG2ahYAR_6128GcTUEo"
}
},
"typeFilter": {
"includedPrimaryTypes": ["bar"]
}
}
}
为了更精确地过滤,您可以明确排除餐馆:
json
{
"insights": ["INSIGHT_COUNT"],
"filter": {
"locationFilter": {
"region": {
"place": "places/ChIJIQBpAG2ahYAR_6128GcTUEo"
}
},
"typeFilter": {
"includedPrimaryTypes": ["bar"],
"excludedTypes": ["restaurant"]
}
}
}