

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Suggest 및 리전 또는 국가를 필터링하는 기능 사용
<a name="suggest-filter-region-country"></a>

Suggest API를 사용하면 결과 위치 또는 범주에 대한 쿼리를 완료할 수 있습니다. 결과는 일치 가능성이 높은 것에서 낮은 것으로 정렬됩니다. 또한 특정 리전 또는 국가로 결과를 추가로 필터링할 수 있습니다.

## 잠재적 사용 사례
<a name="suggest-filter-region-country-potential-use"></a>
+ **결과 필터링: **검색을 수행할 때 국가 또는 비즈니스가 운영되는 리전별로만 필터링할 수 있습니다.

## 예제
<a name="suggest-filter-region-country-examples"></a>

국가별 필터를 추가하면 가장 관련성이 높은 결과만 수신할 수 있습니다. 이를 위해 Filter.IncludeCountries를 사용합니다.

### 사용자가 국가별로 필터링할 수 있도록 활성화
<a name="suggest-filter-region-country-examples"></a>

------
#### [ Sample request ]

```
{
  "QueryText": "hote",
  "BiasPosition": [
    2.2982750966095398, 48.856078089325294
  ],
  "Filter": {
    "IncludeCountries": [
      "FRA"
    ]
  },
  "AdditionalFeatures": [
    "Core"
  ]
}
```

------
#### [ Sample response ]

```
{
    "ResultItems": [
        {
            "Title": "Hôtel de Matignon (Hôtel Matignon)",
            "SuggestResultItemType": "Place",
            "Place": {
                "PlaceId": "Redacted",
                "PlaceType": "PointOfInterest",
                "Address": {
                    "Label": "Hôtel de Matignon, 57 Rue de Varenne, 75007 Paris, France",
                    "Country": {
                        "Code2": "FR",
                        "Code3": "FRA",
                        "Name": "France"
                    },
                    "Region": {
                        "Code": "IDF",
                        "Name": "Île-de-France"
                    },
                    "SubRegion": {
                        "Name": "Paris"
                    },
                    "Locality": "Paris",
                    "District": "7e Arrondissement",
                    "PostalCode": "75007",
                    "Street": "Rue de Varenne",
                    "StreetComponents": [
                        {
                            "BaseName": "Varenne",
                            "Type": "Rue de",
                            "TypePlacement": "BeforeBaseName",
                            "TypeSeparator": " ",
                            "Language": "fr"
                        }
                    ],
                    "AddressNumber": "57"
                },
                "Position": [
                    2.32072,
                    48.85471
                ],
                "Distance": 1650,
                "Categories": [
                    {
                        "Id": "tourist_attraction",
                        "Name": "Tourist Attraction",
                        "LocalizedName": "Attraction touristique",
                        "Primary": true
                    },
                    {
                        "Id": "landmark-attraction",
                        "Name": "Landmark-Attraction",
                        "LocalizedName": "Lieu d'intérêt/Attraction",
                        "Primary": false
                    },
                    {
                        "Id": "historical_monument",
                        "Name": "Historical Monument",
                        "LocalizedName": "Monument historique",
                        "Primary": false
                    },
                    {
                        "Id": "residential_area-building",
                        "Name": "Residential Area-Building",
                        "LocalizedName": "Bâtiment résidentiel",
                        "Primary": false
                    }
                ]
            },
            "Highlights": {
                "Title": [
                    {
                        "StartIndex": 0,
                        "EndIndex": 4,
                        "Value": "Hôt"
                    },
                    {
                        "StartIndex": 19,
                        "EndIndex": 23,
                        "Value": "(Hô"
                    }
                ],
                "Address": {
                    "Label": [
                        {
                            "StartIndex": 0,
                            "EndIndex": 4,
                            "Value": "Hôt"
                        }
                    ]
                }
            }
        },
        ...
        {
            "Title": "Hotel",
            "SuggestResultItemType": "Query",
            "Query": {
                "QueryId": "Redacted",
                "QueryType": "Category"
            },
            "Highlights": {
                "Title": [
                    {
                        "StartIndex": 0,
                        "EndIndex": 4,
                        "Value": "Hote"
                    }
                ]
            }
        },
        ...
    ],
    "QueryRefinements": []
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/suggest?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
  "QueryText": "hote",
  "BiasPosition": [
    2.2982750966095398, 48.856078089325294
  ],
  "Filter": {
    "IncludeCountries": [
      "FRA"
    ]
  },
  "AdditionalFeatures": [
    "Core"
  ]
}'
```

------
#### [ AWS CLI ]

```
aws geo-places suggest --key ${YourKey} \
--query-text "hote" \
--bias-position 2.2982750966095398 48.856078089325294 \
--filter '{"IncludeCountries": ["FRA"]}' \
--additional-features "Core"
```

------

검색에 대해 리전별로 필터링 옵션을 추가하면 제공된 리전에 맞는 옵션으로만 결과가 제한됩니다. 이는 검색 범위를 비즈니스와 관련된 리전으로 제한하는 데 사용됩니다. 다음 예제는 보스턴 지역 근처의 Marriott 호텔에 대한 오타가 있는 검색이 일부 호텔 결과 및 후속 쿼리와 함께 완료되는 것을 보여줍니다.

## 사용자가 리전별로 필터링할 수 있도록 활성화
<a name="suggest-filter-region-examples"></a>

------
#### [ Sample request ]

```
{
  "QueryText": "Mariot",
  "Filter": {
    "IncludeCountries": [
      "USA"
    ],
    "BoundingBox": [
      -71.15693983012913,42.261623506672635,
      -70.97249727163558,42.37584075627763
    ]
  },
  "AdditionalFeatures": [
    "Core"
  ]
}
```

------
#### [ Sample response ]

```
{
    "ResultItems": [
        {
            "Title": "Boston Marriott Copley Place",
            "SuggestResultItemType": "Place",
            "Place": {
                "PlaceId": "Redacted",
                "PlaceType": "PointOfInterest",
                "Address": {
                    "Label": "Boston Marriott Copley Place, 110 Huntington Ave, Boston, MA 02116, United States",
                    "Country": {
                        "Code2": "US",
                        "Code3": "USA",
                        "Name": "United States"
                    },
                    "Region": {
                        "Code": "MA",
                        "Name": "Massachusetts"
                    },
                    "SubRegion": {
                        "Name": "Suffolk"
                    },
                    "Locality": "Boston",
                    "District": "Back Bay",
                    "PostalCode": "02116",
                    "Street": "Huntington Ave",
                    "StreetComponents": [
                        {
                            "BaseName": "Huntington",
                            "Type": "Ave",
                            "TypePlacement": "AfterBaseName",
                            "TypeSeparator": " ",
                            "Language": "en"
                        }
                    ],
                    "AddressNumber": "110"
                },
                "Position": [
                    -71.07769,
                    42.34726
                ],
                "Distance": 3347,
                "Categories": [
                    {
                        "Id": "hotel",
                        "Name": "Hotel",
                        "LocalizedName": "Hotel",
                        "Primary": true
                    }
                ],
                "BusinessChains": [
                    {
                        "Name": "Marriott",
                        "Id": "Marriott"
                    }
                ],
                "AccessPoints": [
                    {
                        "Position": [
                            -71.07922,
                            42.34665
                        ]
                    }
                ]
            },
            "Highlights": {
                "Title": [
                    {
                        "StartIndex": 7,
                        "EndIndex": 14,
                        "Value": "Marriot"
                    }
                ],
                "Address": {
                    "Label": [
                        {
                            "StartIndex": 7,
                            "EndIndex": 14,
                            "Value": "Marriot"
                        }
                    ]
                }
            }
        },
        ...
        {
            "Title": "Marriott",
            "SuggestResultItemType": "Query",
            "Query": {
                "QueryId": "Redacted",
                "QueryType": "BusinessChain"
            },
            "Highlights": {
                "Title": [
                    {
                        "StartIndex": 0,
                        "EndIndex": 8,
                        "Value": "Marriott"
                    }
                ]
            }
        },
        ...
    ],
    "QueryRefinements": []
}
```

------
#### [ cURL ]

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/suggest?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
  "QueryText": "Mariot",
  "Filter": {
    "IncludeCountries": [
      "USA"
    ],
    "BoundingBox": [
      -71.15693983012913,42.261623506672635,
      -70.97249727163558,42.37584075627763
    ]
  },
  "AdditionalFeatures": [
    "Core"
  ]
}'
```

------
#### [ AWS CLI ]

```
aws geo-places suggest --key ${YourKey} \
--query-text "hote" \
--filter '{"IncludeCountries": ["FRA"], "BoundingBox": [ -71.15693983012913,42.261623506672635, -70.97249727163558,42.37584075627763]}' \
--additional-features "Core"
```

------

## 개발자 팁
<a name="suggest-filter-region-developer-tips"></a>

`Title` 응답 필드를 사용하여 검색 결과를 표시하여 사용자에게 간결하고 인식 가능한 항목을 제공합니다. 유사해 보이는 결과의 경우 `Place.Address.Label` 필드를 사용하여 사용자가 둘을 구분하는 데 도움이 되는 추가 주소 세부 정보를 표시합니다. 자세한 내용은 [사용자가 유사한 결과 간에 모호하지 않게 하는 방법Suggest API를 사용하여 결과의 모호성 해소](suggest-disambiguate-results.md) 단원을 참조하십시오.