# Restaurant Search by Location

The **restaurantSearchByLocation** query searches restaurants that match your query term and provided geo location(lat, lon), it returns two lists of results **onPlan** and **otherResults,** each containing a list of [Restaurant](https://production.suggestic.com/documentation#objects-restaurant) objects

* **onPlan** represent restaurants that contains at least one menu items that complies with the user's program and all kind of preferences and restrictions.
* **otherResults** represent restaurants that don't contain any suggested menu items based on non-compliance with the user's program or the user's preferences and restrictions.

### Required Arguments

| Argument                     | Type     | Required | Description                                                                                                                                                                                 |
| ---------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `restaurantSearchByLocation` | query    | False    | Name or keyword of the resturant name. It is possibe to add more than one value. The query is *case insensitive.* For example, **salad** or **Salad** should retreive the same information. |
| `lat`                        | location | True     | Latitude where the restaurant is located                                                                                                                                                    |
| `long`                       | location | True     | Longitud where the restaurant is located                                                                                                                                                    |

### Available Fields

| Field                 | Type   | Description                        |
| --------------------- | ------ | ---------------------------------- |
| `name`                | string | Name of the restaurant             |
| `address1`            | string | Restaurant address                 |
| `recomendationsCount` | string | Number of recommended restaurants  |
| `recommendation`      | string | Name of the recommended restaurant |

## Example

### Restaurant search by using a term and location

The following example retrieves the information of all restaurants which name contains the word "Salad"

{% tabs %}
{% tab title="Query" %}

```graphql
{
  restaurantSearchByLocation(
    query: "Salad",
    lat: 37.790667,
    lon: -122.393481) {
    onPlan {
      name
      address1
      recommendationsCount
      recommendation
    }
    otherResults {
      name
      address1
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "restaurantSearchByLocation": {
      "onPlan": [
        {
          "name": "The Salad Place",
          "address1": "400 London St",
          "recommendationsCount": 1,
          "recommendation": "Garden Salad"
        }
      ],
      "otherResults": [
        {
          "name": "The Salad Place & Rotisserie",
          "address1": "5392 Mission St"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Restaurant search by using two terms and location

The following example retrieves the information of all restaurants which name contains the word "Salad" or "Vegetarian"

{% tabs %}
{% tab title="Query" %}

```graphql
{
  restaurantSearchByLocation(
    query: "Salad Vegetarian",
    lat: 37.790667,
    lon: -122.393481) {
    onPlan {
      name
      address1
      recommendationsCount
      recommendation
    }
    otherResults {
      name
      address1
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "restaurantSearchByLocation": {
      "onPlan": [
        {
          "name": "Enjoy Vegetarian Restaurant",
          "address1": "839 Kearny St",
          "recommendationsCount": 3,
          "recommendation": "Crispy Tofu with Salt and Chili Peppers"
        },
        {
          "name": "Golden Era Vegetarian Restaurant",
          "address1": "572 Ofarrell St",
          "recommendationsCount": 22,
          "recommendation": "Rainbow Salad**"
        },
        {
          "name": "Thai Idea Vegetarian",
          "address1": "710 Polk St",
          "recommendationsCount": 1,
          "recommendation": "Pumpkin Curry"
        },
        {
          "name": "Enjoy Vegetarian Restaurant",
          "address1": "5344 Geary Blvd",
          "recommendationsCount": 1,
          "recommendation": "Steamed Dumplings (10 Pcs)"
        },
        {
          "name": "Enjoy Vegetarian Restaurant",
          "address1": "754 Kirkham St",
          "recommendationsCount": 28,
          "recommendation": "Veggie Deluxe"
        },
        {
          "name": "Shangri-La Vegetarian Restaurant",
          "address1": "2026 Irving St",
          "recommendationsCount": 52,
          "recommendation": "Veggie Shrimp Vegetable With Spicy Sauce"
        },
        {
          "name": "The Salad Place",
          "address1": "400 London St",
          "recommendationsCount": 3,
          "recommendation": "Ceviche Tostada"
        },
        {
          "name": "The Salad Place & Rotisserie",
          "address1": "5392 Mission St",
          "recommendationsCount": 3,
          "recommendation": "Veggie Delight"
        },
        {
          "name": "Central Vegetarian Cuisine",
          "address1": "1613 Park St",
          "recommendationsCount": 38,
          "recommendation": "Wonton Noodle Soup"
        }
      ],
      "otherResults": [
        {
          "name": "The Lucky Creation Vegetarian Restaurant",
          "address1": "854 Washington St"
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.suggestic.com/graphql/query/search/restaurant-search/restaurants.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
