Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GEOSEARCH and GEOSEARCHSTORE commands #2771

Merged
merged 28 commits into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
49393c5
support geosearch and geosearchstore commands
AvitalFineRedis Dec 27, 2021
5ee8ffb
tests
AvitalFineRedis Dec 27, 2021
81d9e9e
Format
sazzad16 Dec 27, 2021
ee93a53
Format Protocol Keywords
sazzad16 Dec 27, 2021
6cf1df8
Support binary commands and pipeline
AvitalFineRedis Dec 27, 2021
f59b895
Merge remote-tracking branch 'AvitalRemote/geosearch_and_geosearchSto…
AvitalFineRedis Dec 27, 2021
d3bdf7e
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 27, 2021
ff7af49
Fix test
AvitalFineRedis Dec 27, 2021
1f96341
format import in GeoSearchParam
sazzad16 Dec 27, 2021
fd11b9f
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 27, 2021
207dbd1
Pipeline
AvitalFineRedis Dec 27, 2021
902be7b
Add the new tests in ...unified... package
AvitalFineRedis Dec 27, 2021
78ad517
fix indent
AvitalFineRedis Dec 27, 2021
32a36b3
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 28, 2021
9fc4d97
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 28, 2021
31877b1
change func names
AvitalFineRedis Dec 28, 2021
267d772
format CommandObjects
sazzad16 Dec 28, 2021
74a9d84
use camel case
sazzad16 Dec 28, 2021
fe148ab
change func names
AvitalFineRedis Dec 28, 2021
135eeb5
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 28, 2021
314e13d
use desc
AvitalFineRedis Dec 28, 2021
668bba6
revert GeoRadiusParam changes
AvitalFineRedis Dec 29, 2021
4a1ac84
Merge branch 'master' into geosearch_and_geosearchStore
AvitalFineRedis Dec 30, 2021
02037b5
stam
AvitalFineRedis Dec 30, 2021
4c0389d
Update src/main/java/redis/clients/jedis/params/GeoSearchParam.java
AvitalFineRedis Dec 30, 2021
a8ce01d
Update GeoSearchParam.java
AvitalFineRedis Dec 30, 2021
d1c1b5f
Merge branch 'master' into geosearch_and_geosearchStore
sazzad16 Dec 30, 2021
82a231f
Merge branch 'master' into geosearch_and_geosearchStore
sazzad16 Dec 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
129 changes: 129 additions & 0 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,135 @@ public final CommandObject<Long> georadiusByMemberStore(byte[] key, byte[] membe
return new CommandObject<>(commandArguments(GEORADIUSBYMEMBER).key(key).add(member)
.add(radius).add(unit).addParams(param).addParams(storeParam), BuilderFactory.LONG);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(String key, String member,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).add(FROMMEMBER).add(member)
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(String key, GeoCoordinate coord,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(String key, String member,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).add(FROMMEMBER).add(member)
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(String key, GeoCoordinate coord,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(String key, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).addParams(params),
BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<Long> geosearchStore(String dest, String src, String member,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).add(FROMMEMBER).add(member)
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(String dest, String src, GeoCoordinate coord,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).add(FROMLONLAT).add(coord.getLongitude())
.add(coord.getLatitude()).add(BYRADIUS).add(radius).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(String dest, String src, String member,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).add(FROMMEMBER).add(member)
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(String dest, String src, GeoCoordinate coord,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(String dest, String src, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).addParams(params), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStoreStoreDist(String dest, String src, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).addParams(params).add(STOREDIST), BuilderFactory.LONG);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(byte[] key, byte[] member,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).add(FROMMEMBER).add(member)
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(byte[] key, GeoCoordinate coord,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(byte[] key, byte[] member,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).add(FROMMEMBER).add(member)
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(byte[] key, GeoCoordinate coord,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<List<GeoRadiusResponse>> geosearch(byte[] key, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCH).key(key).addParams(params),
BuilderFactory.GEORADIUS_WITH_PARAMS_RESULT);
}

public final CommandObject<Long> geosearchStore(byte[] dest, byte[] src, byte[] member,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).add(FROMMEMBER).add(member)
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord,
double radius, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYRADIUS).add(radius).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(byte[] dest, byte[] src, byte[] member,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).add(FROMMEMBER).add(member)
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord,
double width, double height, GeoUnit unit) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src)
.add(FROMLONLAT).add(coord.getLongitude()).add(coord.getLatitude())
.add(BYBOX).add(width).add(height).add(unit), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStore(byte[] dest, byte[] src, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).addParams(params), BuilderFactory.LONG);
}

public final CommandObject<Long> geosearchStoreStoreDist(byte[] dest, byte[] src, GeoSearchParam params) {
return new CommandObject<>(commandArguments(GEOSEARCHSTORE).key(dest).add(src).addParams(params).add(STOREDIST), BuilderFactory.LONG);
}
// Geo commands

// Hyper Log Log commands
Expand Down
132 changes: 132 additions & 0 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -4291,6 +4291,72 @@ public long georadiusByMemberStore(final byte[] key, final byte[] member, final
return connection.executeCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam));
}

@Override
public List<GeoRadiusResponse> geosearch(byte[] key, byte[] member, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, member, radius, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(byte[] key, GeoCoordinate coord, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, coord, radius, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(byte[] key, byte[] member, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, member, width, height, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(byte[] key, GeoCoordinate coord, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, coord, width, height, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(byte[] key, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, params));
}

@Override
public long geosearchStore(byte[] dest, byte[] src, byte[] member, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, member, radius, unit));
}

@Override
public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit));
}

@Override
public long geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit));
}

@Override
public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit));
}

@Override
public long geosearchStore(byte[] dest, byte[] src, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, params));
}

@Override
public long geosearchStoreStoreDist(byte[] dest, byte[] src, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStoreStoreDist(dest, src, params));
}

@Override
public List<GeoRadiusResponse> georadiusByMemberReadonly(final byte[] key, final byte[] member,
final double radius, final GeoUnit unit, final GeoRadiusParam param) {
Expand Down Expand Up @@ -8282,6 +8348,72 @@ public List<GeoRadiusResponse> georadiusByMemberReadonly(final String key, final
return connection.executeCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param));
}

@Override
public List<GeoRadiusResponse> geosearch(String key, String member, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, member, radius, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, coord, radius, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(String key, String member, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, member, width, height, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, coord, width, height, unit));
}

@Override
public List<GeoRadiusResponse> geosearch(String key, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearch(key, params));
}

@Override
public long geosearchStore(String dest, String src, String member, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, member, radius, unit));
}

@Override
public long geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit));
}

@Override
public long geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit));
}

@Override
public long geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit));
}

@Override
public long geosearchStore(String dest, String src, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStore(dest, src, params));
}

@Override
public long geosearchStoreStoreDist(String dest, String src, GeoSearchParam params) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.geosearchStoreStoreDist(dest, src, params));
}

@Override
public String moduleLoad(final String path) {
checkIsInMultiOrPipeline();
Expand Down