[ https://issues.apache.org/jira/browse/SOLR-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913011#action_12913011 ]
Yonik Seeley commented on SOLR-2125: ------------------------------------ Ok Grant & I chatted and we figured out what's going wrong. We were calculating a box the size that would completely fit inside the circle rather than vice-versa. This was caused by taking the distance and projecting it out to calculate the corners of the box. But the distance given should really be to the side of the box... and the distance from the center to the corner of the box should be greater (if the box is to completely encompass the circle). The fix should be easy - the distance to the corner of the box is sqrt(2) * dist_to_size_of_box. So internally we just need to multiply the distance by sqrt(2) before finding the corners. Grant is coding up the fix and tests. > Spatial filter is not accurate > ------------------------------ > > Key: SOLR-2125 > URL: https://issues.apache.org/jira/browse/SOLR-2125 > Project: Solr > Issue Type: Bug > Components: Build > Affects Versions: 1.5 > Reporter: Bill Bell > Assignee: Grant Ingersoll > > The calculations of distance appears to be off. > Note: "The radius of the sphere to be used when calculating distances on a > sphere (i.e. haversine). Default is the Earth's mean radius in kilometers > (see org.apache.solr.search.function.distance.Constants.EARTH_MEAN_RADIUS_KM) > which is set to 3,958.761458084784856. Most applications will not need to set > this." > The radius of the earth in KM is 6371.009 km (≈3958.761 mi). > Also filtering distance appears to be off - example data: > 45.17614,-93.87341 to 44.9369054,-91.3929348 Approx 137 miles Google. 169 > miles = 220 kilometers > http://....../solr/select?fl=*,score&start=0&rows=10&q={!sfilt%20fl=store_lat_lon}&qt=standard&pt=44.9369054,-91.3929348&d=280&sort=dist(2,store,vector(44.9369054,-91.3929348)) > asc > Nothing shows. d=285 shows results. This is off by a lot. > Bill -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org