We now allow usage of @GeoIndexed to mark GeoLocation or Point properties as candidates for secondary index creation. Non null values will be included in GEOADD command as follows:
GEOADD keyspace:property-path point.x point.y entity-id
@GeoIndexed can be used on top level as well as on nested properties.
class Person {
@Id String id;
String firstname, lastname;
Address hometown;
}
class Address {
String city, street, housenumber;
@GeoIndexed Point location;
}
The above allows us to derive geospatial queries from a given method using NEAR and WITHIN keywords like:
interface PersonRepository extends CrudRepository<Person, String> {
List<Person> findByAddressLocationNear(Point point, Distance distance);
List<Person> findByAddressLocationWithin(Circle circle);
}
Partial updates on the Point itself also trigger an index refresh operation. So it is possible to alter existing entities via:
template.save(new PartialUpdate<Person>("1", Person.class).set("address.location", new Point(17, 18));
Original pull request: #215.