setAroundRadius method

AlgoliaQuery setAroundRadius(
  1. dynamic value
)

AroundRadius

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

Usage notes:

  • This setting only works within the context of a radial (circuler) 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 axist point.
    • If you use all, there is no longer any filtering based on the radius. All relevant results are returned, but the ranking is still based on the distance from the central axis point.
    • If you do not 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, allowing all results to be returned, regardless of distance. Ranking is still based on proxiùmity to the central axis point. This option is faster than specifying a high integer value.

value must be a int or 'all'

1 = 1 Meter

Therefore for 1000 = 1 Kilometer

'aroundRadius' => 1000 // 1km

Source: Learn more

Implementation

AlgoliaQuery setAroundRadius(dynamic value) {
  assert(value != null);
  assert(!_parameters.containsKey('aroundRadius'));
  assert((value is int || (value is String && value == 'all')),
      'value must be a `int` or `"all"`');
  return _copyWithParameters(<String, dynamic>{'aroundRadius': value});
}