

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 如何获取部分输入或拼写错误的查询的结果
<a name="how-to-get-results-for-partial-or-misspelled-queries"></a>

通过建议 API，应用程序可以针对地点或结果类别完成用户查询。这些结果按照匹配可能性从高到低进行排序，允许该 API 解析不完整或拼写错误的词。

## 潜在使用案例
<a name="potential-use"></a>
+ **补全部分输入的兴趣点查询：**根据部分输入或不正确的条目提供建议，从而为用户提供帮助。

## 示例
<a name="suggest-api-examples"></a>

### 查找拼写错误的兴趣点
<a name="misspelled-point-of-interest"></a>

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

```
{
  "QueryText": "Effel tow",
  "Filter": {
    "Circle": {
      "Radius": 10000,
      "Center": [2.3431932014695382, 48.858844492141145]
    },
    "IncludeCountries": ["FRA"]
  },
  "AdditionalFeatures": ["Core"]
}
```

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

```
{
    "ResultItems": [
        {
            "Title": "Tour Eiffel (Eiffel Tower)",
            "SuggestResultItemType": "Place",
            "Place": {
                "PlaceId": "<Redacted>",
                "PlaceType": "PointOfInterest",
                "Address": {
                    "Label": "Tour Eiffel, 5 Avenue Anatole France, 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": "Avenue Anatole France",
                    "StreetComponents": [{"BaseName": "Anatole France", "Type": "Avenue", "Language": "fr"}],
                    "AddressNumber": "5"
                },
                "Position": [2.2945, 48.85824],
                "Distance": 3563,
                "Categories": [
                    {"Id": "historical_monument", "Name": "Historical Monument", "LocalizedName": "Monument historique", "Primary": true},
                    {"Id": "landmark-attraction", "Name": "Landmark-Attraction", "LocalizedName": "Lieu d'intérêt/Attraction", "Primary": false},
                    {"Id": "tourist_attraction", "Name": "Tourist Attraction", "LocalizedName": "Attraction touristique", "Primary": false},
                    {"Id": "sports_complex-stadium", "Name": "Sports Complex-Stadium", "LocalizedName": "Stade ou complexe sportif", "Primary": false}
                ]
            },
            "Highlights": {"Title": [{"StartIndex": 13, "EndIndex": 23, "Value": "Eiffel Tow"}]}
        }
    ],
    "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": "Effel tow",
  "Filter": {
    "Circle": {"Radius": 10000, "Center": [2.3431932014695382, 48.858844492141145]},
    "IncludeCountries": ["FRA"]
  },
  "AdditionalFeatures": ["Core"]
}'
```

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

```
aws geo-places suggest --key ${YourKey} \
--query-text "Effel tow" \
--filter '{"Circle": {"Radius": 1000, "Center": [2.3431932014695382, 48.858844492141145]}, "IncludeCountries": ["FRA"]}' \
--additional-features "Core"
```

------

## 开发人员提示
<a name="developer-tips"></a>

将 `Filter.IncludeCountries` 或 `Filter.BoundingBox` 之类的筛选条件与 `BiasPosition` 结合使用。这些筛选条件有助于缩小可能结果的范围并提高准确性。

```
{
  "QueryText": "Effel tow",
  "BiasPosition": [2.2982750966095398, 48.856078089325294],
  "Filter": {"IncludeCountries": ["FRA"]}
}
```