> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# aroundRadius

> Maximum radius in meters for a search around a central coordinate

export const Setting = ({type, default: defaultValue, defaultNote, scope, min, max, formerly}) => {
  const renderedDefault = defaultValue === '' ? '""' : defaultValue;
  const renderedNote = defaultNote ? `(${defaultNote})` : '';
  return <ul>
      <li><strong>Type:</strong> <code>{type}</code></li>
      <li><strong>Default:</strong> <code>{renderedDefault}</code>{renderedNote}</li>
      {min && <li><strong>Min:</strong> <code>{min}</code></li>}
      {max && <li><strong>Max:</strong> <code>{max}</code></li>}
      <li><strong>Scope:</strong> <a href="/doc/api-reference/api-parameters"><code>{scope}</code></a></li>
      {formerly && <li>
          <strong>Deprecated name:</strong> <code>{formerly}</code>
        </li>}
    </ul>;
};

<Setting type="integer | &#x22;all&#x22;" default="null" scope="search" />

The `aroundRadius` parameter defines the **maximum distance (in meters)** from the central location within which results are returned.
Used with [`aroundLatLng`](/doc/api-reference/api-parameters/aroundLatLng) or [`aroundLatLngViaIP`](/doc/api-reference/api-parameters/aroundLatLngViaIP),
this limits how far from the center Algolia will retrieve results.

## Usage

* Applies only to radial searches around a location.
* Works only when \[`aroundLatLng`] or \[`aroundLatLngViaIP`] is set.
* The [Geo ranking criterion](/doc/guides/managing-results/refine-results/geolocation) must be in your ranking formula (included by default).
* If omitted, Algolia dynamically calculates the radius based on result density.
* To enforce a minimum radius, use [`minimumAroundRadius`](/doc/api-reference/api-parameters/minimumAroundRadius).

## Options

<ParamField path="integer">
  Maximum radius in meters.
  Results beyond this distance are excluded.
</ParamField>

<ParamField path="all">
  Includes all records with a `_geoloc` attribute, regardless of distance from the center.
  Ranks results by proximity to the center.
  Faster than setting a large integer value.
</ParamField>

## Example

<AccordionGroup>
  <Accordion title="Current API clients" defaultOpen="true">
    <CodeGroup>
      ```cs C# theme={"system"}
      var response = await client.SearchSingleIndexAsync<Hit>(
        "INDEX_NAME",
        new SearchParams(
          new SearchParamsObject { Query = "query", AroundRadius = new AroundRadius(1000) }
        )
      );
      ```

      ```dart Dart theme={"system"}
      final response = await client.searchSingleIndex(
        indexName: "INDEX_NAME",
        searchParams: SearchParamsObject(
          query: "query",
          aroundRadius: 1000,
        ),
      );
      ```

      ```go Go theme={"system"}
      response, err := client.SearchSingleIndex(client.NewApiSearchSingleIndexRequest(
        "INDEX_NAME").WithSearchParams(search.SearchParamsObjectAsSearchParams(
        search.NewEmptySearchParamsObject().SetQuery("query").SetAroundRadius(search.Int32AsAroundRadius(1000)))))
      if err != nil {
        // handle the eventual error
        panic(err)
      }
      ```

      ```java Java theme={"system"}
      SearchResponse response = client.searchSingleIndex(
        "INDEX_NAME",
        new SearchParamsObject().setQuery("query").setAroundRadius(AroundRadius.of(1000)),
        Hit.class
      );
      ```

      ```js JavaScript theme={"system"}
      const response = await client.searchSingleIndex({
        indexName: 'indexName',
        searchParams: { query: 'query', aroundRadius: 1000 },
      });
      ```

      ```kotlin Kotlin theme={"system"}
      var response =
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = SearchParamsObject(query = "query", aroundRadius = AroundRadius.of(1000)),
        )
      ```

      ```php PHP theme={"system"}
      $response = $client->searchSingleIndex(
          'INDEX_NAME',
          ['query' => 'query',
              'aroundRadius' => 1000,
          ],
      );
      ```

      ```python Python theme={"system"}
      response = client.search_single_index(
          index_name="INDEX_NAME",
          search_params={
              "query": "query",
              "aroundRadius": 1000,
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      response = client.search_single_index(
        "INDEX_NAME",
        Algolia::Search::SearchParamsObject.new(query: "query", around_radius: 1000)
      )
      ```

      ```scala Scala theme={"system"}
      val response = Await.result(
        client.searchSingleIndex(
          indexName = "INDEX_NAME",
          searchParams = Some(
            SearchParamsObject(
              query = Some("query"),
              aroundRadius = Some(AroundRadius(1000))
            )
          )
        ),
        Duration(100, "sec")
      )
      ```

      ```swift Swift theme={"system"}
      let response: SearchResponse<Hit> = try await client.searchSingleIndex(
          indexName: "INDEX_NAME",
          searchParams: SearchSearchParams.searchSearchParamsObject(SearchSearchParamsObject(
              query: "query",
              aroundRadius: SearchAroundRadius.int(1000)
          ))
      )
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Legacy API clients">
    <CodeGroup>
      ```cs C# theme={"system"}
      index.Search(new Query("query") { AroundRadius = 1000 });
      ```

      ```go Go theme={"system"}
      res, err := index.Search(
      	"query",
      	opt.AroundRadius(1000), // 1km
      )
      ```

      ```java Java theme={"system"}
      index.search(
              new Query("query")
                      .setAroundRadius(AroundRadius.of(1000))
      );
      ```

      ```js JavaScript theme={"system"}
      index
        .search("query", {
          aroundRadius: 1000, // 1km
        })
        .then(({ hits }) => {
          console.log(hits);
        });
      ```

      ```kotlin Kotlin theme={"system"}
      val query = query("query") {
          aroundRadius = AroundRadius.InMeters(1000)
      }

      index.search(query)
      ```

      ```php PHP theme={"system"}
      $results = $index->search('query', [
        'aroundRadius' => 1000 // 1km
      ]);
      ```

      ```python Python theme={"system"}
      results = index.search(
          "query",
          {
              "aroundRadius": 1000  # 1km
          },
      )
      ```

      ```ruby Ruby theme={"system"}
      results = index.search(
        "query",
        {
          # 1km
          aroundRadius: 1000
        }
      )
      ```

      ```scala Scala theme={"system"}
      client.execute {
        search into "myIndex" query Query(
          query = Some("query"),
          aroundRadius = Some(AroundRadius.integer(1000))
        )
      }
      ```

      ```swift Swift theme={"system"}
      let query = Query("query")
        .set(\.aroundRadius, to: .meters(1000))

      index.search(query: query) { result in
        if case .success(let response) = result {
          print("Response: \(response)")
        }
      }
      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>
