aroundLatLng
null
'aroundLatLng' => 'latitude, longitude' // 2 floats
Can be used in these methods:
search,
browseObjects,
deleteBy,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
delete_by,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browseObjects,
deleteBy,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
browse_objects,
delete_by,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
browse,
deleteBy,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
browseObjects,
deleteObjectBy,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
Browse,
DeleteBy,
SearchForFacetValues,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
browse,
deleteBy,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
BrowseObjects,
DeleteBy,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
browse index,
delete by,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter
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
orinsidePolygon
-
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 ashitsPerPage=20
.
Examples
Search around a position
1
2
3
$results = $index->search('query', [
'aroundLatLng' => '40.71, -74.01'
]);