如何協助使用者在類似結果之間模糊不清 - Amazon Location Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

如何協助使用者在類似結果之間模糊不清

建議 API 可讓您建立結果位置或類別的查詢。結果會針對較不可能相符的項目進行排序。每個結果都會提供資訊,協助您快速識別正確的相符項目,尤其是標題和標籤欄位。

潛在的使用案例

  • 顯示結果選項:您可以選擇最適合您需求的選項。

範例

標題欄位通常是足夠的資訊,可讓您了解結果何時是預期的。對於標題未提供足夠資訊的情況,標籤欄位用於將地址資訊內容新增至結果。標籤欄位可以作為第二行資訊提供,當結果為您轉譯時,會從主要文字中取消強調。在以下範例中,提供了兩個類似的結果,而飯店的地址可協助您選擇更符合您需求的結果。此外,還提供位置,以便在地圖上轉譯結果,做為您在結果之間選取的其他方式。

Sample request
{ "QueryText": "Marriott", "Filter": { "IncludeCountries": [ "USA" ], "BoundingBox": [ -71.15693983012913,42.261623506672635, -70.97249727163558,42.37584075627763 ] }, "AdditionalFeatures": [ "Core" ] }
Sample response
{ "ResultItems": [ { "Title": "Marriott-Boston Cambridge", "SuggestResultItemType": "Place", "Place": { "PlaceId": "Redacted", "PlaceType": "PointOfInterest", "Address": { "Label": "Marriott-Boston Cambridge, 50 Broadway, Cambridge, MA 02138-4137, United States", "Country": { "Code2": "US", "Code3": "USA", "Name": "United States" }, "Region": { "Code": "MA", "Name": "Massachusetts" }, "SubRegion": { "Name": "Middlesex" }, "Locality": "Cambridge", "District": "MIT", "PostalCode": "02138-4137", "Street": "Broadway", "StreetComponents": [ { "BaseName": "Broadway", "Language": "en" } ], "AddressNumber": "50" }, "Position": [ -71.0858, 42.36294 ], "Distance": 5212, ... }, { "Title": "Marriott-Boston Copley Place", "SuggestResultItemType": "Place", "Place": { "PlaceId": "Redacted", "PlaceType": "PointOfInterest", "Address": { "Label": "Marriott-Boston Copley Place, 110 Huntington Ave, Boston, MA 02116-5706, 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-5706", "Street": "Huntington Ave", "StreetComponents": [ { "BaseName": "Huntington", "Type": "Ave", "TypePlacement": "AfterBaseName", "TypeSeparator": " ", "Language": "en" } ], "AddressNumber": "110" }, "Position": [ -71.0792, 42.34701 ], "Distance": 3362, ... }, ... ], "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": "Marriott", "Filter": { "IncludeCountries": [ "USA" ], "BoundingBox": [ -71.15693983012913,42.261623506672635, -70.97249727163558,42.37584075627763 ] }, "AdditionalFeatures": [ "Core" ] }'
AWS CLI
aws geo-places suggest --key ${YourKey} \ --query-text "Marriott" \ --filter '{"IncludeCountries": ["USA"], "BoundingBox": [ -71.15693983012913,42.261623506672635, -70.97249727163558,42.37584075627763]}' \ --additional-features "Core"