setAroundLatLng method

AlgoliaQuery setAroundLatLng(
  1. String value
)

AroundLatLng

Search for entries around a central geolocation, enabling a geo search within a circular area.

By defining this central point, there are three consequences:

  • a radius / circle is computed automatically, based on the density of the records near the point defined by this setting
  • only records that fall within the bounds of the circle are returned
  • records are ranked according to the distance from the center of the circle

Usage notes:

  • With this setting, you are defining a central point of a circle, whose geo-coordinates are expressed as two floats separated by a comma.
  • Note: This setting differs from aroundLatLngViaIP, which uses the end user’s IP to determine the geo-coordinates.
  • This parameter will be ignored if used along with insideBoundingBox or insidePolygon
  • To control the maximum size of the radius, you would use aroundRadius.
  • To control the minimum size, you would use minimumAroundRadius.
  • The size of this radius depends on the density of the area around the central point. If there are a large number of hits close to the central point, the radius can be small. The less hits near the center, the larger the radius will be.
  • Note: If the results returned are less than the number of hits per page (hitsPerPage), then the number returned will be less than the hitsPerPage. For example, if you recieve 15 results, you could still see a larger number of hits per page, such as hitsPerPage=20.

Source: Learn more

Implementation

AlgoliaQuery setAroundLatLng(String value) {
  assert(value.isNotEmpty, 'value can not be empty');
  assert(!_parameters.containsKey('aroundLatLng'));
  return _copyWithParameters(<String, dynamic>{'aroundLatLng': value});
}