[hibernate-dev] [HSEARCH] Geospatial indexing and queries

Hardy Ferentschik hardy at hibernate.org
Wed Dec 21 09:19:20 EST 2011


On Dec 21, 2011, at 2:59 PM, Emmanuel Bernard wrote:

> Which one do you prefer (line in bold for each sample)?
> 
> 			builder
> 				.spatial()
> 					.onCoordinates( "location" )  or .forCoordinates("location") or .forLocation("location") or something else
> 					.within( 500, Unit.KM )
> 						.of().latitude(48.858333d).longitude(2.294444d)
> 					.createQuery();

			builder
				.spatial()
				        .forLocation("location") 
					.within( 500, Unit.KM )
						.of().latitude(48.858333d).longitude(2.294444d)
					.createQuery();

On a side node, do we really need 'of()'. Sure it makes it sounds a little more like real English, but then why is there no 'and()' between lat and long.
The whole DSL part only carries so far when directly hosted in Java. If there is no compelling reason for 'of()' i would argue one can drop it.

what's about 'proximity' instead of 'spatial'?


> 			builder
> 				.spatial()
> 					.onLatitudeField( "latitude" ).onLongitudeField( "longitude" ) or .forLatitudeField( "latitude" ).forLongitudeField( "longitude" )  or something else
> 					.within( 51, Unit.KM )
> 						.of().latitude( 24d ).longitude( 31.5d )
> 					.createQuery();

			builder
				.spatial()
					.onFields(long, lat)
					.within( 51, Unit.KM )
						.of().latitude( 24d ).longitude( 31.5d )
					.createQuery();

--Hardy



More information about the hibernate-dev mailing list