See https://issues.apache.org/jira/browse/SOLR-773. In other words, we're working on it and would love some help!

-Grant

On May 12, 2009, at 7:12 AM, Norman Leutner wrote:

Hi together,

I'm new to Solr and want to port a geographical range search from MySQL to Solr.

Currently I'm using some mathematical functions (based on GRS80 modell) directly within MySQL to calculate the actual distance from the locations within the database to a current location (lat and long are known):

$query=SELECT street, zip, city, state, country, ". $radius."*ACOS(cos(RADIANS(latitude))*cos(". $theta.")*(sin(RADIANS(longitude))*sin(".$phi.") +cos(RADIANS(longitude))*cos(".$phi."))+sin(RADIANS(latitude))*sin(". $theta.")) AS Distance FROM ezgis_position WHERE ". $radius."*ACOS(cos(RADIANS(latitude))*cos(". $theta.")*(sin(RADIANS(longitude))*sin(".$phi.") +cos(RADIANS(longitude))*cos(".$phi."))+sin(RADIANS(latitude))*sin(". $theta.")) <= ".$range." ORDER BY Distance";

This works pretty fine and fast. Due to we want to include this within our Solr search result I would like to have a attribute like "actual_distance" within the result. Is there a way to use those functions like (radians, sin, acos,...) directly within Solr?

Thanks in advance for any feedback
Norman Leutner

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using Solr/Lucene:
http://www.lucidimagination.com/search

Reply via email to