[TYPO3-mvc] Queries for a localized vendor search service

Matthias Nagl t3v4mvc at mnagl.de
Mon Sep 19 10:58:13 CEST 2011


I am going to implement a localized search that shows a user the closest 
vendors for a special service.

To realize this I have a database table containing  vendors and their 
coordinates (latitude, longitude). The search results shall be presented 
ordered by distance. As the website only covers vendors in a rather small 
region it would be perfectly sufficiant to compute Euclidean distances.
In MySQL syntax the query should look like this:
SELECT ... ORDER BY SQRT(POW(lat - userlat, 2)*latweight + POW(lng - userlng, 
2)*lngweight);
in this query userlat and userlng would be the user's coordinates and 
latweight as well as lngweight the average distance between degrees of 
lat/longitude.

My Question:
Is it possible zu create such an ordering using the extbase query object or is 
it at least possible to inject the ordering-part of SQL code into a query 
object without creating the whole with the $query->statement() method.

Cheers

Matthias


More information about the TYPO3-project-typo3v4mvc mailing list