クエリのスペル ミスを修正する
このチュートリアルでは、API でクエリのスペル ミスを修正する方法を説明します。
手順
ニュージャージー州のユーザーが、携帯電話でアプリを使用してニューヨーク (New York) ジャイアンツのサッカー スタジアムを検索している場合、クエリで「r」を省略し、このスタジアムを「New Yok Gia」と誤って入力します。
GET https://autosuggest.search.hereapi.com/v1
/autosuggest
?at=40.8870025,-74.0459472
&q=New+Yok+Gia
&limit=2
&apiKey={YOUR_API_KEY}次のパラメーターを使用します。
- at - 座標で表される検索コンテキストの中心を指定します。
- q - 名前を入力します。
- limit - 返される結果の最大数。
- apiKey - APIキー。
注
このリクエストはAPIキー認証を使用します。HEREプラットフォームの認証オプションの詳細については、「Identity & Access Management Guide」(IDとアクセス管理ガイド)を参照してください。
APIは、items内に「ニューヨークジャイアンツ」の正しい位置情報を含めています。
{
"items": [
{
"title": "New York Giants",
"id": "here:pds:place:8408lxx5-e06a65cc857e0b16d1700eb05bf23def",
"resultType": "place",
"address": { "label": "New York Giants, 1 Road D, East Rutherford, NJ 07073, United States" },
"position": { "lat": 40.81509, "lng": -74.07485 },
"access": [{ "lat": 40.81521, "lng": -74.07483 }],
"distance": 8357,
"categories": [
{ "id": "800-8600-0197", "name": "Sports Activities", "primary": true },
{ "id": "200-2000-0015", "name": "Live Entertainment-Music" },
{ "id": "200-2200-0000", "name": "Theatre, Music and Culture" }
],
"references": [{ "supplier": { "id": "yelp" }, "id": "M3oWhuYk1zA_m8XnFQcUsg" }],
"highlights": { "title": [{ "start": 0, "end": 12 }], "address": { "label": [{ "start": 0, "end": 12 }] } }
},
{
"title": "New York, NY, United States",
"id": "here:cm:namedplace:21019301",
"resultType": "locality",
"localityType": "city",
"address": { "label": "New York, NY, United States" },
"position": { "lat": 40.71455, "lng": -74.00714 },
"distance": 19452,
"mapView": { "west": -74.2589, "south": 40.47742, "east": -73.70038, "north": 40.91762 },
"highlights": { "title": [{ "start": 0, "end": 8 }], "address": { "label": [{ "start": 0, "end": 8 }] } }
}
],
"queryTerms": [ ]
}追加情報
/autosuggestエンドポイントパラメーターの詳細については、「APIリファレンス」を参照してください。
4 日前の更新