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
This PR implements [`GEOSEARCH`](https://redis.io/commands/geosearch/) and [`GEOSEARCHSTORE`](https://redis.io/commands/geosearchstore/) for #2055
To abstract the box/circle sub-options from GEOSEARCH I added a new abstract class `GeoSearchShape` who's children are responsible for maintaining the bounding shape, its unit of measurement, the number of arguments required for the sub-option, and of course the sub-option name. Rather than casting/extracting the arguments, I have it use an IEnumerable state-machine with yield/return. Wasn't sure which was the better option, the IEnumerable seemed cleaner, open to whichever you want.
I changed the `GEORADIUS` pattern of having a `GeoSearch(key, member, args. . .)` and a `GeoSearch(key, lon, lat, args. . .)`, and instead have `GeoSearchByMember` and `GeoSearchByCoordinates`. If I'm honest, it was because my IDE was complaining about breaking compatibility rules by having more than 1 override with optional parameters, not sure if you have a strong feeling on this.
Co-authored-by: Nick Craver <[email protected]>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
198
+
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
199
+
/// </summary>
200
+
/// <param name="key">The key of the set.</param>
201
+
/// <param name="member">The set member to use as the center of the shape.</param>
202
+
/// <param name="shape">The shape to use to bound the geo search.</param>
203
+
/// <param name="count">The maximum number of results to pull back.</param>
204
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
205
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
206
+
/// <param name="options">The search options to use</param>
207
+
/// <param name="flags">The flags for this operation.</param>
208
+
/// <returns>The results found within the shape, if any.</returns>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
214
+
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
215
+
/// </summary>
216
+
/// <param name="key">The key of the set.</param>
217
+
/// <param name="longitude">The longitude of the center point.</param>
218
+
/// <param name="latitude">The latitude of the center point.</param>
219
+
/// <param name="shape">The shape to use to bound the geo search.</param>
220
+
/// <param name="count">The maximum number of results to pull back.</param>
221
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
222
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
223
+
/// <param name="options">The search options to use</param>
224
+
/// <param name="flags">The flags for this operation.</param>
225
+
/// <returns>The results found within the shape, if any.</returns>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
231
+
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
232
+
/// </summary>
233
+
/// <param name="sourceKey">The key of the set.</param>
234
+
/// <param name="destinationKey">The key to store the result at.</param>
235
+
/// <param name="member">The set member to use as the center of the shape.</param>
236
+
/// <param name="shape">The shape to use to bound the geo search.</param>
237
+
/// <param name="count">The maximum number of results to pull back.</param>
238
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
239
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
240
+
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
241
+
/// <param name="flags">The flags for this operation.</param>
242
+
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
248
+
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
249
+
/// </summary>
250
+
/// <param name="sourceKey">The key of the set.</param>
251
+
/// <param name="destinationKey">The key to store the result at.</param>
252
+
/// <param name="longitude">The longitude of the center point.</param>
253
+
/// <param name="latitude">The latitude of the center point.</param>
254
+
/// <param name="shape">The shape to use to bound the geo search.</param>
255
+
/// <param name="count">The maximum number of results to pull back.</param>
256
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
257
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
258
+
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
259
+
/// <param name="flags">The flags for this operation.</param>
260
+
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
185
+
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
186
+
/// </summary>
187
+
/// <param name="key">The key of the set.</param>
188
+
/// <param name="member">The set member to use as the center of the shape.</param>
189
+
/// <param name="shape">The shape to use to bound the geo search.</param>
190
+
/// <param name="count">The maximum number of results to pull back.</param>
191
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
192
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
193
+
/// <param name="options">The search options to use.</param>
194
+
/// <param name="flags">The flags for this operation.</param>
195
+
/// <returns>The results found within the shape, if any.</returns>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
201
+
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
202
+
/// </summary>
203
+
/// <param name="key">The key of the set.</param>
204
+
/// <param name="longitude">The longitude of the center point.</param>
205
+
/// <param name="latitude">The latitude of the center point.</param>
206
+
/// <param name="shape">The shape to use to bound the geo search.</param>
207
+
/// <param name="count">The maximum number of results to pull back.</param>
208
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
209
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
210
+
/// <param name="options">The search options to use.</param>
211
+
/// <param name="flags">The flags for this operation.</param>
212
+
/// <returns>The results found within the shape, if any.</returns>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
218
+
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
219
+
/// </summary>
220
+
/// <param name="sourceKey">The key of the set.</param>
221
+
/// <param name="destinationKey">The key to store the result at.</param>
222
+
/// <param name="member">The set member to use as the center of the shape.</param>
223
+
/// <param name="shape">The shape to use to bound the geo search.</param>
224
+
/// <param name="count">The maximum number of results to pull back.</param>
225
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
226
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
227
+
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
228
+
/// <param name="flags">The flags for this operation.</param>
229
+
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
235
+
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
236
+
/// </summary>
237
+
/// <param name="sourceKey">The key of the set.</param>
238
+
/// <param name="destinationKey">The key to store the result at.</param>
239
+
/// <param name="longitude">The longitude of the center point.</param>
240
+
/// <param name="latitude">The latitude of the center point.</param>
241
+
/// <param name="shape">The shape to use to bound the geo search.</param>
242
+
/// <param name="count">The maximum number of results to pull back.</param>
243
+
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
244
+
/// <param name="order">The order to sort by (defaults to unordered).</param>
245
+
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
246
+
/// <param name="flags">The flags for this operation.</param>
247
+
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
0 commit comments