クエリのスペルミスを修正
このチュートリアルでは、 API がクエリのスペルミスを修正する方法について説明します。
プロシージャ
ニュージャージー州のユーザーが、携帯電話でアプリ を使用してニューヨークジャイアンツのサッカースタジアムを検索しています。このスタジアムの文字 "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 platform の認証オプションの詳細については、『ID およびアクセス管理ガイド』を参照してください。
API のアイテムには、「ニューヨークジャイアンツ」の正しい場所が含まれています。
{
"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 リファレンス。