API Reference / API Parameters / aroundRadius
Type: integer | "all"
Engine default: null
Parameter syntax
'aroundRadius' => radius_in_meters|'all'

Can be used in these methods:

About this parameter

Define the maximum radius for a geo search (in meters).

Usage notes

  • This setting only works within the context of a radial (circular) geo search, enabled by aroundLatLngViaIP or aroundLatLng.

  • How the radius is calculated:

    • If you specify the meters of the radius (instead of all), then only records that fall within the bounds of the circle (as defined by the radius) will be returned. Additionally, the ranking of the returned hits will be based on the distance from the central axis point.

    • If you use all, there is no longer any filtering based on the radius. The engine returns all relevant results with a valid _geoloc attribute. The ranking is still based on the distance from the central axis point.

    • If you don’t use this setting, and yet perform a radial geo search (using aroundLatLngViaIP or aroundLatLng), the radius is automatically computed from the density of the searched area. See also minimumAroundRadius, which determines the minimum size of the radius.

  • For this setting to have any effect on your ranking, the geo criterion must be included in your ranking formula (which is the case by default).

Options:

  • radius_in_meters: Integer value (in meters) representing the radius around the coordinates specified during the query.

  • all: Disables the radius logic and returns all results with a valid _geoloc attribute, regardless of distance. Ranking is still based on proximity to the central axis point. This option is faster than specifying a high integer value.

Examples

Set manual radius filtering

1
2
3
$results = $index->search('query', [
  'aroundRadius' => 1000 // 1km
]);

Disable automatic radius filtering

1
2
3
$results = $index->search('query', [
  'aroundRadius' => 'all'
]);
Did you find this page helpful?