-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support GEOSHAPE field type in RediSearch
- Loading branch information
Showing
5 changed files
with
159 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/redis/clients/jedis/search/schemafields/GeoShapeField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package redis.clients.jedis.search.schemafields; | ||
|
||
import static redis.clients.jedis.search.SearchProtocol.SearchKeyword.GEOSHAPE; | ||
|
||
import redis.clients.jedis.CommandArguments; | ||
import redis.clients.jedis.search.FieldName; | ||
|
||
public class GeoShapeField extends SchemaField { | ||
|
||
public enum CoordinateSystem { | ||
FLAT, | ||
SPHERICAL | ||
} | ||
|
||
private final CoordinateSystem system; | ||
|
||
public GeoShapeField(String fieldName, CoordinateSystem system) { | ||
super(fieldName); | ||
this.system = system; | ||
} | ||
|
||
public GeoShapeField(FieldName fieldName, CoordinateSystem system) { | ||
super(fieldName); | ||
this.system = system; | ||
} | ||
|
||
public static GeoShapeField of(String fieldName, CoordinateSystem system) { | ||
return new GeoShapeField(fieldName, system); | ||
} | ||
|
||
@Override | ||
public GeoShapeField as(String attribute) { | ||
super.as(attribute); | ||
return this; | ||
} | ||
|
||
@Override | ||
public void addParams(CommandArguments args) { | ||
args.addParams(fieldName).add(GEOSHAPE).add(system); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters