Package glide.api.commands
Interface GeospatialIndicesBaseCommands
-
- All Known Implementing Classes:
BaseClient,GlideClient,GlideClusterClient
public interface GeospatialIndicesBaseCommandsSupports commands for the "Geospatial Indices Commands" group for standalone and cluster clients.- See Also:
- Geospatial Indices Commands
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>geoadd(GlideString key, java.util.Map<GlideString,GeospatialData> membersToGeospatialData)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.
To perform ageoaddoperation while specifying optional parameters, usegeoadd(String, Map, GeoAddOptions).java.util.concurrent.CompletableFuture<java.lang.Long>geoadd(GlideString key, java.util.Map<GlideString,GeospatialData> membersToGeospatialData, GeoAddOptions options)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.java.util.concurrent.CompletableFuture<java.lang.Long>geoadd(java.lang.String key, java.util.Map<java.lang.String,GeospatialData> membersToGeospatialData)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.
To perform ageoaddoperation while specifying optional parameters, usegeoadd(String, Map, GeoAddOptions).java.util.concurrent.CompletableFuture<java.lang.Long>geoadd(java.lang.String key, java.util.Map<java.lang.String,GeospatialData> membersToGeospatialData, GeoAddOptions options)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.java.util.concurrent.CompletableFuture<java.lang.Double>geodist(GlideString key, GlideString member1, GlideString member2)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.java.util.concurrent.CompletableFuture<java.lang.Double>geodist(GlideString key, GlideString member1, GlideString member2, GeoUnit geoUnit)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.java.util.concurrent.CompletableFuture<java.lang.Double>geodist(java.lang.String key, java.lang.String member1, java.lang.String member2)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.java.util.concurrent.CompletableFuture<java.lang.Double>geodist(java.lang.String key, java.lang.String member1, java.lang.String member2, GeoUnit geoUnit)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.java.util.concurrent.CompletableFuture<GlideString[]>geohash(GlideString key, GlideString[] members)Returns theGeoHashstrings representing the positions of all the specifiedmembersin the sorted set stored atkey.java.util.concurrent.CompletableFuture<java.lang.String[]>geohash(java.lang.String key, java.lang.String[] members)Returns theGeoHashstrings representing the positions of all the specifiedmembersin the sorted set stored atkey.java.util.concurrent.CompletableFuture<java.lang.Double[][]>geopos(GlideString key, GlideString[] members)Returns the positions (longitude,latitude) of all the specifiedmembersof the geospatial index represented by the sorted set atkey.java.util.concurrent.CompletableFuture<java.lang.Double[][]>geopos(java.lang.String key, java.lang.String[] members)Returns the positions (longitude,latitude) of all the specifiedmembersof the geospatial index represented by the sorted set atkey.java.util.concurrent.CompletableFuture<GlideString[]>geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.Object[]>geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.Object[]>geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<GlideString[]>geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.String[]>geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.Object[]>geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.Object[]>geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.String[]>geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.java.util.concurrent.CompletableFuture<java.lang.Long>geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination.
-
-
-
Method Detail
-
geoadd
java.util.concurrent.CompletableFuture<java.lang.Long> geoadd(java.lang.String key, java.util.Map<java.lang.String,GeospatialData> membersToGeospatialData, GeoAddOptions options)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.- Parameters:
key- The key of the sorted set.membersToGeospatialData- A mapping of member names to their corresponding positions - seeGeospatialData. The command will report an error when the user attempts to index coordinates outside the specified ranges.options- The GeoAdd options - seeGeoAddOptions- Returns:
- The number of elements added to the sorted set. If
changedis set totruein the options, returns the number of elements updated in the sorted set. - See Also:
- valkey.io for more details.
- Example:
GeoAddOptions options = new GeoAddOptions(ConditionalChange.ONLY_IF_EXISTS, true); Long num = client.geoadd("mySortedSet", Map.of("Palermo", new GeospatialData(13.361389, 38.115556)), options).get(); assert num == 1L; // Indicates that the position of an existing member in the sorted set "mySortedSet" has been updated.
-
geoadd
java.util.concurrent.CompletableFuture<java.lang.Long> geoadd(GlideString key, java.util.Map<GlideString,GeospatialData> membersToGeospatialData, GeoAddOptions options)
Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.- Parameters:
key- The key of the sorted set.membersToGeospatialData- A mapping of member names to their corresponding positions - seeGeospatialData. The command will report an error when the user attempts to index coordinates outside the specified ranges.options- The GeoAdd options - seeGeoAddOptions- Returns:
- The number of elements added to the sorted set. If
changedis set totruein the options, returns the number of elements updated in the sorted set. - See Also:
- valkey.io for more details.
- Example:
GeoAddOptions options = new GeoAddOptions(ConditionalChange.ONLY_IF_EXISTS, true); Long num = client.geoadd(gs("mySortedSet"), Map.of(gs("Palermo"), new GeospatialData(13.361389, 38.115556)), options).get(); assert num == 1L; // Indicates that the position of an existing member in the sorted set gs("mySortedSet") has been updated.
-
geoadd
java.util.concurrent.CompletableFuture<java.lang.Long> geoadd(java.lang.String key, java.util.Map<java.lang.String,GeospatialData> membersToGeospatialData)Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.
To perform ageoaddoperation while specifying optional parameters, usegeoadd(String, Map, GeoAddOptions).- Parameters:
key- The key of the sorted set.membersToGeospatialData- A mapping of member names to their corresponding positions - seeGeospatialData. The command will report an error when the user attempts to index coordinates outside the specified ranges.- Returns:
- The number of elements added to the sorted set.
- See Also:
- valkey.io for more details.
- Example:
Long num = client.geoadd("mySortedSet", Map.of("Palermo", new GeospatialData(13.361389, 38.115556), "Catania", new GeospatialData(15.087269, 37.502669)).get(); assert num == 2L; // Indicates that two elements have been added to the sorted set "mySortedSet".
-
geoadd
java.util.concurrent.CompletableFuture<java.lang.Long> geoadd(GlideString key, java.util.Map<GlideString,GeospatialData> membersToGeospatialData)
Adds geospatial members with their positions to the specified sorted set stored atkey.
If a member is already a part of the sorted set, its position is updated.
To perform ageoaddoperation while specifying optional parameters, usegeoadd(String, Map, GeoAddOptions).- Parameters:
key- The key of the sorted set.membersToGeospatialData- A mapping of member names to their corresponding positions - seeGeospatialData. The command will report an error when the user attempts to index coordinates outside the specified ranges.- Returns:
- The number of elements added to the sorted set.
- See Also:
- valkey.io for more details.
- Example:
Long num = client.geoadd(gs("mySortedSet"), Map.of(gs("Palermo"), new GeospatialData(13.361389, 38.115556), gs("Catania"), new GeospatialData(15.087269, 37.502669)).get(); assert num == 2L; // Indicates that two elements have been added to the sorted set gs("mySortedSet").
-
geopos
java.util.concurrent.CompletableFuture<java.lang.Double[][]> geopos(java.lang.String key, java.lang.String[] members)Returns the positions (longitude,latitude) of all the specifiedmembersof the geospatial index represented by the sorted set atkey.- Parameters:
key- The key of the sorted set.members- The members for which to get the positions.- Returns:
- A 2D
arraywhich represent positions (longitude and latitude) corresponding to the given members. If a member does not exist, its position will be null. - See Also:
- valkey.io for more details.
- Example:
// When added via GEOADD, the geospatial coordinates are converted into a 52 bit geohash, so the coordinates // returned might not be exactly the same as the input values client.geoadd("mySortedSet", Map.of("Palermo", new GeospatialData(13.361389, 38.115556), "Catania", new GeospatialData(15.087269, 37.502669))).get(); Double[][] result = client.geopos("mySortedSet", new String[]{"Palermo", "Catania", "NonExisting"}).get(); System.out.println(Arrays.deepToString(result));
-
geopos
java.util.concurrent.CompletableFuture<java.lang.Double[][]> geopos(GlideString key, GlideString[] members)
Returns the positions (longitude,latitude) of all the specifiedmembersof the geospatial index represented by the sorted set atkey.- Parameters:
key- The key of the sorted set.members- The members for which to get the positions.- Returns:
- A 2D
arraywhich represent positions (longitude and latitude) corresponding to the given members. If a member does not exist, its position will be null. - See Also:
- valkey.io for more details.
- Example:
// When added via GEOADD, the geospatial coordinates are converted into a 52 bit geohash, so the coordinates // returned might not be exactly the same as the input values client.geoadd(gs("mySortedSet"), Map.of(gs("Palermo"), new GeospatialData(13.361389, 38.115556), gs("Catania"), new GeospatialData(15.087269, 37.502669))).get(); Double[][] result = client.geopos(gs("mySortedSet", new GlideString[]{gs("Palermo"), gs("Catania"), gs("NonExisting")}).get(); System.out.println(Arrays.deepToString(result));
-
geodist
java.util.concurrent.CompletableFuture<java.lang.Double> geodist(java.lang.String key, java.lang.String member1, java.lang.String member2, GeoUnit geoUnit)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.- Parameters:
key- The key of the sorted set.member1- The name of the first member.member2- The name of the second member.geoUnit- The unit of distance measurement - seeGeoUnit.- Returns:
- The distance between
member1andmember2. If one or both members do not exist, or if the key does not exist, returnsnull. - See Also:
- valkey.io for more details.
- Example:
Double result = client.geodist("mySortedSet", "Palermo", "Catania", GeoUnit.KILOMETERS).get(); System.out.println(result);
-
geodist
java.util.concurrent.CompletableFuture<java.lang.Double> geodist(GlideString key, GlideString member1, GlideString member2, GeoUnit geoUnit)
Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.- Parameters:
key- The key of the sorted set.member1- The name of the first member.member2- The name of the second member.geoUnit- The unit of distance measurement - seeGeoUnit.- Returns:
- The distance between
member1andmember2. If one or both members do not exist, or if the key does not exist, returnsnull. - See Also:
- valkey.io for more details.
- Example:
Double result = client.geodist(gs("mySortedSet"), gs("Palermo"), gs("Catania"), GeoUnit.KILOMETERS).get(); System.out.println(result);
-
geodist
java.util.concurrent.CompletableFuture<java.lang.Double> geodist(java.lang.String key, java.lang.String member1, java.lang.String member2)Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.- Parameters:
key- The key of the sorted set.member1- The name of the first member.member2- The name of the second member.- Returns:
- The distance between
member1andmember2. If one or both members do not exist, or if the key does not exist, returnsnull. The default unit is {@see GeoUnit#METERS}. - See Also:
- valkey.io for more details.
- Example:
Double result = client.geodist("mySortedSet", "Palermo", "Catania").get(); System.out.println(result);
-
geodist
java.util.concurrent.CompletableFuture<java.lang.Double> geodist(GlideString key, GlideString member1, GlideString member2)
Returns the distance betweenmember1andmember2saved in the geospatial index stored atkey.- Parameters:
key- The key of the sorted set.member1- The name of the first member.member2- The name of the second member.- Returns:
- The distance between
member1andmember2. If one or both members do not exist, or if the key does not exist, returnsnull. The default unit is {@see GeoUnit#METERS}. - See Also:
- valkey.io for more details.
- Example:
Double result = client.geodist(gs("mySortedSet"), gs("Palermo"), gs("Catania")).get(); System.out.println(result);
-
geohash
java.util.concurrent.CompletableFuture<java.lang.String[]> geohash(java.lang.String key, java.lang.String[] members)Returns theGeoHashstrings representing the positions of all the specifiedmembersin the sorted set stored atkey.- Parameters:
key- The key of the sorted set.members- The array of members whoseGeoHashstrings are to be retrieved.- Returns:
- An array of
GeoHashstrings representing the positions of the specified members stored atkey. If a member does not exist in the sorted set, anullvalue is returned for that member. - See Also:
- valkey.io for more details.
- Example:
String[] result = client.geohash("mySortedSet", new String[] {"Palermo", "Catania", "NonExisting"}).get(); System.out.println(Arrays.toString(result)); // prints a list of corresponding GeoHash String values
-
geohash
java.util.concurrent.CompletableFuture<GlideString[]> geohash(GlideString key, GlideString[] members)
Returns theGeoHashstrings representing the positions of all the specifiedmembersin the sorted set stored atkey.- Parameters:
key- The key of the sorted set.members- The array of members whoseGeoHashstrings are to be retrieved.- Returns:
- An array of
GeoHashstrings representing the positions of the specified members stored atkey. If a member does not exist in the sorted set, anullvalue is returned for that member. - See Also:
- valkey.io for more details.
- Example:
GlideString[] result = client.geohash(gs("mySortedSet"), new GlideString[] {gs("Palermo"), gs("Catania"), gs("NonExisting")}).get(); System.out.println(Arrays.toString(result)); // prints a list of corresponding GeoHash String values
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.String[]> geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
- Returns:
- An
arrayof matched member names. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
String[] expected = new String[] {"Catania", "Palermo"}; String[] result = client .geosearch( "a1", new GeoSearchOrigin.MemberOrigin("Palermo"), new GeoSearchShape(200, GeoUnit.KILOMETERS)) .get(); assert Arrays.equals(expected, result);
-
geosearch
java.util.concurrent.CompletableFuture<GlideString[]> geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)
Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
- Returns:
- An
arrayof matched member names. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
GlideString[] expected = new GlideString[] {gs("Catania"), gs("Palermo")}; GlideString[] result = client .geosearch( gs("a1"), new GeoSearchOrigin.MemberOriginBinary(gs("Palermo")), new GeoSearchShape(200, GeoUnit.KILOMETERS)) .get(); assert Arrays.equals(expected, result);
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.String[]> geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- An
arrayof matched member names. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
String[] expected = new String[] {"Catania", "Palermo"}; String[] result = client .geosearch( "a1", new GeoSearchOrigin("Palermo"), new GeoSearchShape(200, GeoUnit.KILOMETERS), SortOrder.ASC) .get(); assert Arrays.equals(expected, result);
-
geosearch
java.util.concurrent.CompletableFuture<GlideString[]> geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)
Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- An
arrayof matched member names. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
GlideString[] expected = new GlideString[] {gs("Catania"), gs("Palermo")}; GlideString[] result = client .geosearch( gs("a1"), new GeoSearchOrigin.MemberOriginBinary(gs("Palermo")), new GeoSearchShape(200, GeoUnit.KILOMETERS), SortOrder.ASC) .get(); assert Arrays.equals(expected, result);
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.Object[]> geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.- Returns:
- An array of arrays where each sub-array represents a single item in the following
order:
- The member (location) name.
- The distance from the center as a
Double, in the same unit specified forsearchBy. - The geohash of the location as a
Long. - The coordinates as a two item
arrayofDouble.
- Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Object[] expected = new Object[] { new Object[] { // name "Palermo", new Object[] { // distance, hash and coordinates 0.0, 3479099956230698L, new Object[] {13.361389338970184, 38.1155563954963} } }, new Object[] { "Catania", new Object[] { 166.2742, 3479447370796909L, new Object[] {15.087267458438873, 37.50266842333162} } } }; Object[] result = client .geosearch( "a1", new GeoSearchOrigin("Palermo"), new GeoSearchShape(200, GeoUnit.KILOMETERS), new GeoSearchOptions.GeoSearchOptionsBuilder() .withcoord() .withdist() .withhash() .count(3) .build(), SortOrder.ASC) .get(); // The result contains the data in the same format as expected.
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.Object[]> geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options)
Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.- Returns:
- An array of arrays where each sub-array represents a single item in the following
order:
- The member (location) name.
- The distance from the center as a
Double, in the same unit specified forsearchBy. - The geohash of the location as a
Long. - The coordinates as a two item
arrayofDouble.
- Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Object[] expected = new Object[] { new Object[] { // name gs("Palermo"), new Object[] { // distance, hash and coordinates 0.0, 3479099956230698L, new Object[] {13.361389338970184, 38.1155563954963} } }, new Object[] { gs("Catania"), new Object[] { 166.2742, 3479447370796909L, new Object[] {15.087267458438873, 37.50266842333162} } } }; Object[] result = client .geosearch( gs("a1"), new GeoSearchOrigin.MemberOriginBinary(gs("Palermo")), new GeoSearchShape(200, GeoUnit.KILOMETERS), new GeoSearchOptions.GeoSearchOptionsBuilder() .withcoord() .withdist() .withhash() .count(3) .build(), SortOrder.ASC) .get(); // The result contains the data in the same format as expected.
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.Object[]> geosearch(java.lang.String key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options, GeoSearchResultOptions resultOptions)Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information. See -GeoSearchOptionsresultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- An array of arrays where each sub-array represents a single item in the following
order:
- The member (location) name.
- The distance from the center as a
Double, in the same unit specified forsearchBy. - The geohash of the location as a
Long. - The coordinates as a two item
arrayofDouble.
- Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Object[] expected = new Object[] { new Object[] { // name "Palermo", new Object[] { // distance, hash and coordinates 0.0, 3479099956230698L, new Object[] {13.361389338970184, 38.1155563954963} } }, new Object[] { "Catania", new Object[] { 166.2742, 3479447370796909L, new Object[] {15.087267458438873, 37.50266842333162} } } }; Object[] result = client .geosearch( "a1", new GeoSearchOrigin("Palermo"), new GeoSearchShape(200, GeoUnit.KILOMETERS), new GeoSearchOptions.GeoSearchOptionsBuilder() .withcoord() .withdist() .withhash() .count(3) .build(), SortOrder.ASC) .get(); // The result contains the data in the same format as expected.
-
geosearch
java.util.concurrent.CompletableFuture<java.lang.Object[]> geosearch(GlideString key, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchOptions options, GeoSearchResultOptions resultOptions)
Returns the members of a sorted set populated with geospatial information usinggeoadd(String, Map), which are within the borders of the area specified by a given shape.- Parameters:
key- The key of the sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information. See -GeoSearchOptionsresultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- An array of arrays where each sub-array represents a single item in the following
order:
- The member (location) name.
- The distance from the center as a
Double, in the same unit specified forsearchBy. - The geohash of the location as a
Long. - The coordinates as a two item
arrayofDouble.
- Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Object[] expected = new Object[] { new Object[] { // name gs("Palermo"), new Object[] { // distance, hash and coordinates 0.0, 3479099956230698L, new Object[] {13.361389338970184, 38.1155563954963} } }, new Object[] { gs("Catania"), new Object[] { 166.2742, 3479447370796909L, new Object[] {15.087267458438873, 37.50266842333162} } } }; Object[] result = client .geosearch( gs("a1"), new GeoSearchOrigin.MemberOriginBinary(gs("Palermo")), new GeoSearchShape(200, GeoUnit.KILOMETERS), new GeoSearchOptions.GeoSearchOptionsBuilder() .withcoord() .withdist() .withhash() .count(3) .build(), SortOrder.ASC) .get(); // The result contains the data in the same format as expected.
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS)) .get(); assert result == 4L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy)
Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS)) .get(); assert result == 4L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchResultOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), new GeoSearchResultOptions(2, true)) .get(); assert result == 2L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchResultOptions resultOptions)
Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchResultOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), new GeoSearchResultOptions(2, true)) .get(); assert result == 2L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), GeoSearchStoreOptions.builder().storedist().build()) .get(); assert result == 4L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options)
Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginBinaryto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), GeoSearchStoreOptions.builder().storedist().build()) .get(); assert result == 4L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(java.lang.String destination, java.lang.String source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options, GeoSearchResultOptions resultOptions)Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchOptions, GeoSearchResultOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), GeoSearchStoreOptions.builder().storedist().build() new GeoSearchResultOptions(2, true)) .get(); assert result == 2L;
-
geosearchstore
java.util.concurrent.CompletableFuture<java.lang.Long> geosearchstore(GlideString destination, GlideString source, GeoSearchOrigin.SearchOrigin searchFrom, GeoSearchShape searchBy, GeoSearchStoreOptions options, GeoSearchResultOptions resultOptions)
Searches for members in a sorted set stored atsourcerepresenting geospatial data within a circular or rectangular area and stores the result indestination. Ifdestinationalready exists, it is overwritten. Otherwise, a new sorted set will be created. To get the result directly, see `geosearch(String, SearchOrigin, GeoSearchShape, GeoSearchOptions, GeoSearchResultOptions).- Parameters:
destination- The key of the destination sorted set.source- The key of the source sorted set.searchFrom- The query's center point options, could be one of:GeoSearchOrigin.MemberOriginto use the position of the given existing member in the sorted set.GeoSearchOrigin.CoordOriginto use the given longitude and latitude coordinates.
searchBy- The query's shape options:GeoSearchShape(double, GeoUnit)to search inside circular area according to given radius.GeoSearchShape(double, double, GeoUnit)to search inside an axis-aligned rectangle, determined by height and width.
options- The optional inputs to request additional information.resultOptions- Optional inputs for sorting/limiting the results. See -GeoSearchResultOptions- Returns:
- The number of elements in the resulting sorted set stored at
destination. - Since:
- Valkey 6.2.0 and above.
- See Also:
- valkey.io for more details.
- Example:
Long result = client .geosearchstore( destinationKey, sourceKey, new CoordOrigin(new GeospatialData(15, 37)), new GeoSearchShape(400, 400, GeoUnit.KILOMETERS), GeoSearchStoreOptions.builder().storedist().build() new GeoSearchResultOptions(2, true)) .get(); assert result == 2L;
-
-