

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Come effettuare una ricerca utilizzando il nome della categoria o il tipo di alimento
<a name="how-to-search-category-name"></a>

L'`SearchText`API ti consente di cercare per nome di categorie come ristoranti, scuole e altro. Puoi anche cercare per tipo di cibo.

Un modo per utilizzare l' SearchText API consiste nel consentire agli utenti finali di effettuare ricerche per nome (categoria e tipo di alimento) e per posizione di orientamento del set di applicazioni. Queste posizioni di polarizzazione possono essere la posizione del dispositivo, la posizione IP o il centro della porta di visualizzazione di una mappa. Inoltre, gli utenti finali possono fornire il nome o il luogo della città e l'applicazione può modificare i risultati in base alle coordinate geografiche.

Per ulteriori informazioni, consultare [Filtri per categorie](places-filtering.md#place-categories) e [Filtri Food Type](places-filtering.md#food-type).

## Casi d'uso potenziali
<a name="potential-use-category-name"></a>
+ Cerca POI o luoghi specifici come parte dell'esplorazione di un quartiere. 
+ Cerca una località turistica specifica per la pianificazione del viaggio.
+ Cerca ristoranti che servono un cibo specifico.

## Esempi
<a name="search-category-examples"></a>

### Cerca in base a una categoria
<a name="search-category-result"></a>

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

```
{
    "QueryText": "Nursing Home",
    "BiasPosition": [
                -123.11336,
                49.26038
            ],    
}
```

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

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "Diamond Geriatrics Inc",
            "Address": {
                "Label": "Diamond Geriatrics Inc, 288 W 8th Ave, Vancouver, BC V5Y 1N5, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Vancouver",
                "District": "Mt Pleasant",
                "PostalCode": "V5Y 1N5",
                "Street": "W 8th Ave",
                "StreetComponents": [
                    {
                        "BaseName": "8th",
                        "Type": "Ave",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Prefix": "W",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "288"
            },
            "Position": [
                -123.11061,
                49.2636
            ],
            "Distance": 410,
            "Categories": [
                {
                    "Id": "nursing_home",
                    "Name": "Nursing Home",
                    "LocalizedName": "Nursing Home",
                    "Primary": true
                },
                {
                    "Id": "social_service",
                    "Name": "Social Service",
                    "LocalizedName": "Social Services",
                    "Primary": false
                }
            ]
        },
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "Para Med Home Health Care",
            "Address": {
                "Label": "Para Med Home Health Care, 601 W Broadway, Vancouver, BC V5Z 4C2, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Vancouver",
                "District": "Fairview",
                "PostalCode": "V5Z 4C2",
                "Street": "W Broadway",
                "StreetComponents": [
                    {
                        "BaseName": "Broadway",
                        "Prefix": "W",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "601"
            },
            "Position": [
                -123.11772,
                49.26343
            ],
            "Distance": 464,
            "Categories": [
                {
                    "Id": "nursing_home",
                    "Name": "Nursing Home",
                    "LocalizedName": "Nursing Home",
                    "Primary": true
                },
                {
                    "Id": "hospital_or_health_care_facility",
                    "Name": "Hospital or Health Care Facility",
                    "LocalizedName": "Hospital or Health Care Facility",
                    "Primary": false
                }
            ]
        }
        ...
        ...
    ]
}
```

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

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-text?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
    "QueryText": "Nursing Home",
    "BiasPosition": [
                -123.11336,
                49.26038
            ]
}'
```

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

```
aws geo-places search-text --key ${YourKey} --query-text "Nursing Home" --bias-position -123.11336 49.26038
```

------

### Cerca per tipo di alimento
<a name="search-food-result"></a>

Specificate un tipo di cibo `QueryText` per selezionare i ristoranti per tipo di cibo. Il filtraggio per tipo di cibo consente ai ristoranti di essere indicizzati, interrogati e visualizzati per tipo di cibo.

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

```
{
    "QueryText": "Sushi",
    "BiasPosition": [
                -123.11336,
                49.26038
            ]
}
```

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

```
{
    "ResultItems": [
        {
            "PlaceId": "<Redacted>",
            "PlaceType": "PointOfInterest",
            "Title": "Sushi Tomy",
            "Address": {
                "Label": "Sushi Tomy, 555 W 12th Ave, Vancouver, BC V5Z 3X7, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Vancouver",
                "District": "Fairview",
                "PostalCode": "V5Z 3X7",
                "Street": "W 12th Ave",
                "StreetComponents": [
                    {
                        "BaseName": "12th",
                        "Type": "Ave",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Prefix": "W",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "555"
            },
            "Position": [
                -123.11629,
                49.26086
            ],
            "Distance": 219,
            "Categories": [
                {
                    "Id": "deli",
                    "Name": "Deli",
                    "LocalizedName": "Deli",
                    "Primary": true
                },
                {
                    "Id": "restaurant",
                    "Name": "Restaurant",
                    "LocalizedName": "Restaurant",
                    "Primary": false
                },
                {
                    "Id": "casual_dining",
                    "Name": "Casual Dining",
                    "LocalizedName": "Casual Dining",
                    "Primary": false
                }
            ],
            "FoodTypes": [
                {
                    "LocalizedName": "Japanese - Sushi",
                    "Id": "japanese-sushi",
                    "Primary": true
                },
                {
                    "LocalizedName": "Canadian",
                    "Id": "canadian",
                    "Primary": false
                },
                {
                    "LocalizedName": "Japanese",
                    "Id": "japanese",
                    "Primary": false
                }
            ]
        },
        {
            "PlaceId": "<Redacted>"
            "PlaceType": "PointOfInterest",
            "Title": "Shiro Japanese Restaurant",
            "Address": {
                "Label": "Shiro Japanese Restaurant, 3096 Cambie St, Vancouver, BC V5Z 2V9, Canada",
                "Country": {
                    "Code2": "CA",
                    "Code3": "CAN",
                    "Name": "Canada"
                },
                "Region": {
                    "Code": "BC",
                    "Name": "British Columbia"
                },
                "SubRegion": {
                    "Name": "Metro Vancouver"
                },
                "Locality": "Vancouver",
                "District": "Mt Pleasant",
                "PostalCode": "V5Z 2V9",
                "Street": "Cambie St",
                "StreetComponents": [
                    {
                        "BaseName": "Cambie",
                        "Type": "St",
                        "TypePlacement": "AfterBaseName",
                        "TypeSeparator": " ",
                        "Language": "en"
                    }
                ],
                "AddressNumber": "3096"
            },
            "Position": [
                -123.11461,
                49.25797
            ],
            "Distance": 283,
            "Categories": [
                {
                    "Id": "casual_dining",
                    "Name": "Casual Dining",
                    "LocalizedName": "Casual Dining",
                    "Primary": true
                },
                {
                    "Id": "restaurant",
                    "Name": "Restaurant",
                    "LocalizedName": "Restaurant",
                    "Primary": false
                }
            ],
            "FoodTypes": [
                {
                    "LocalizedName": "Japanese - Sushi",
                    "Id": "japanese-sushi",
                    "Primary": true
                },
                {
                    "LocalizedName": "Asian",
                    "Id": "asian",
                    "Primary": false
                },
                {
                    "LocalizedName": "Japanese",
                    "Id": "japanese",
                    "Primary": false
                }
            ]
        },
        ...
        ...
    ]
}
```

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

```
curl --request POST \
  --url 'https://places.geo.eu-central-1.amazonaws.com/v2/search-text?key=Your_Key' \
  --header 'Content-Type: application/json' \
  --data '{
    "QueryText": "Sushi",
    "BiasPosition": [
                -123.11336,
                49.26038
            ]
}'
```

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

```
aws geo-places search-text --key ${YourKey} --query-text "Sushi" --bias-position -123.11336 49.26038
```

------