@Retention(value=RUNTIME) @Target(value={METHOD,FIELD,TYPE}) @Documented public @interface Spatial
SpatialMode.RANGE approach.
Otherwise, they can be indexed using a spatial hash index. This is known as the
SpatialMode.HASH approach. The size of the grid can be adjusted with topSpatialHashLevel
and bottomSpatialHashLevel.
For more information on which model to use, read the Hibernate Search reference documentation.
If your longitude and latitude information are hosted on free properties,
Add @Spatial on the entity (class-level). The Latitude and Longitude
annotations must mark the properties.
@Entity
@Spatial(name="home")
public class User {
@Latitude(of="home")
public Double getHomeLatitude() { ... }
@Longitude(of="home")
public Double getHomeLongitude() { ... }
}
Alternatively, you can put the latitude / longitude information in a property of
type Coordinates.
@Entity
public class User {
@Spatial
public Coordinates getHome() { ... }
}
| Modifier and Type | Fields and Description |
|---|---|
static String |
COORDINATES_DEFAULT_FIELD
Prefix used to generate field names for a default
Spatial annotation |
| Modifier and Type | Optional Element and Description |
|---|---|
Boost |
boost |
int |
bottomSpatialHashLevel |
String |
name
The name of the field prefix where spatial index
information is stored in a Lucene document.
|
SpatialMode |
spatialMode |
Store |
store |
int |
topSpatialHashLevel |
public abstract String name
@Spatial is hosted on a property, defaults to the property name.public abstract SpatialMode spatialMode
Copyright © 2006–2017 Hibernate. All rights reserved.