Package org.hibernate.search.annotations
Annotation Type Spatial
-
@Retention(RUNTIME) @Target({METHOD,FIELD,TYPE}) @Documented @Deprecated @Repeatable(Spatials.class) @TypeMapping(processor=@TypeMappingAnnotationProcessorRef(type=org.hibernate.search.annotations.impl.SpatialAnnotationProcessor.class,retrieval=CONSTRUCTOR)) @PropertyMapping(processor=@PropertyMappingAnnotationProcessorRef(type=org.hibernate.search.annotations.impl.SpatialAnnotationProcessor.class,retrieval=CONSTRUCTOR)) public @interface Spatial
Deprecated.If the latitude/longitude of the element annotated withSpatialare mutable, annotate these properties annotated withLatitude/Longitude, and useGeoPointBindinginstead ofSpatial. If the latitude/longitude of the element annotated withSpatialare immutable, you can alternatively implementGeoPointinstead ofCoordinatesand simply useGenericFieldon properties of this type.Defines a spatial property. Spatial coordinates can be indexed as latitude / longitude fields and queried via range queries. This is known as theSpatialMode.RANGEapproach. Otherwise, they can be indexed using a spatial hash index. This is known as theSpatialMode.HASHapproach. The size of the grid can be adjusted withtopSpatialHashLevelandbottomSpatialHashLevel. 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@Spatialon the entity (class-level). TheLatitudeandLongitudeannotations 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 typeCoordinates.@Entity public class User { @Spatial public Coordinates getHome() { ... } }- Author:
- Nicolas Helleringer
- Experimental
- Spatial support is still considered experimental
-
-
Field Summary
Fields Modifier and Type Fields Description static StringCOORDINATES_DEFAULT_FIELDDeprecated.Prefix used to generate field names for a defaultSpatialannotation
-
-
-
Element Detail
-
name
String name
Deprecated.The name of the field prefix where spatial index information is stored in a Lucene document. If@Spatialis hosted on a property, defaults to the property name.- Returns:
- the field name
- Default:
- ""
-
-