You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: helper/lib/src/model/search_state.dart
+202-3Lines changed: 202 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,12 @@ class SearchState implements MultiSearchState {
40
40
this.tagFilters,
41
41
this.userToken,
42
42
this.clickAnalytics,
43
+
this.aroundLatLngViaIP,
44
+
this.aroundLatLng,
45
+
this.aroundRadius,
46
+
this.minimumAroundRadius,
47
+
this.aroundPrecision,
48
+
this.insideBoundingBox,
43
49
});
44
50
45
51
/// Index name
@@ -122,6 +128,169 @@ class SearchState implements MultiSearchState {
122
128
/// events.
123
129
finalbool? clickAnalytics;
124
130
131
+
///
132
+
/// **AroundLatLngViaIP**
133
+
///
134
+
/// Search for entries around a given location automatically computed from the requester’s IP address.
135
+
/// By computing a central geolocation (from an IP), this has three consequences:
136
+
/// - a radius / circle is computed automatically, based on the density of the records near the point defined by this setting
137
+
/// - only records that fall within the bounds of the circle are returned
138
+
/// - records are ranked according to the distance from the center of the circle
139
+
///
140
+
/// **Usage notes:**
141
+
/// - With this setting, you are using the end user’s IP to define a central axis point of a circle in geo-coordinates.
142
+
/// - Algolia automatically calculates the size of the circular radius around this central axis.
143
+
/// - To control the precise size of the radius, you would use [aroundRadius].
144
+
/// - To control a minimum size, you would use [minimumAroundRadius].
145
+
/// - If you are sending the request from your servers, you must set the X-Forwarded-For HTTP header with the front-end user’s IP address for it to be used as the basis for the computation of the search location.
146
+
/// - Note: This setting differs from [aroundLatLng], which allows you to specify the exact latitude and longitude of the center of the circle.
147
+
/// - This parameter will be ignored if used along with [insideBoundingBox] or [insidePolygon]
148
+
/// - We currently only support IPv4 addresses. If the end user has an IPv6 address, this parameter won’t work as intended.
/// Search for entries around a central geolocation, enabling a geo search within a circular area.
158
+
///
159
+
/// By defining this central point, there are three consequences:
160
+
/// - a radius / circle is computed automatically, based on the density of the records near the point defined by this setting
161
+
/// - only records that fall within the bounds of the circle are returned
162
+
/// - records are ranked according to the distance from the center of the circle
163
+
///
164
+
/// **Usage notes:**
165
+
/// - With this setting, you are defining a central point of a circle, whose geo-coordinates are expressed as two floats separated by a comma.
166
+
/// - Note: This setting differs from [aroundLatLngViaIP], which uses the end user’s IP to determine the geo-coordinates.
167
+
/// - This parameter will be ignored if used along with [insideBoundingBox] or [insidePolygon]
168
+
/// - To control the maximum size of the radius, you would use [aroundRadius].
169
+
/// - To control the minimum size, you would use [minimumAroundRadius].
170
+
/// - 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.
171
+
/// - 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.
/// Precision of geo search (in meters), to add grouping by geo location to the ranking
223
+
/// formula.
224
+
///
225
+
/// When ranking hits, geo distances are grouped into ranges of `aroundPrecision` size.
226
+
/// All hits within the same range are considered equal with respect to the `geo` ranking
227
+
/// parameter.
228
+
///
229
+
/// For example, if you set `aroundPrecision` to `100`, any two objects lying in the range
230
+
/// `[0, 99m]` from the searched location will be considered equal; same for `[100, 199]`,
231
+
/// `[200, 299]`, etc.
232
+
///
233
+
/// Usage notes:
234
+
/// - For this setting to have any effect, the [geo criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/in-depth/ranking-criteria#geo-if-applicable)
235
+
/// must be included in your ranking formula (which is the case by default).
0 commit comments