[ https://issues.apache.org/jira/browse/SOLR-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12913182#action_12913182 ]
Grant Ingersoll commented on SOLR-2125: --------------------------------------- bq. The Local Solr from Patrick projected the ur, ll using the distance and did a range check to see if the points are in the box.It is a close approximation. An ellipses would be closer. Circle is not close enough. OK, so I went back to that code and looked and we are doing the same thing (in fact, I based it off of that). Namely, the only thing that is not working in the code is the interpretation of the results and not the math itself. To that point, Bill, if you look at the points you gave, it is right on the edge of a box that is centered on that point (roughly, Chippewa Falls, WI), but still outside, of the box that was created by Solr (at 280KM). I worked this out by viewing the maps at: 1. http://www.movable-type.co.uk/scripts/latlong-map.html?lat1=44.936905&long1=-91.392935&lat2=43.09&long2=-93.87341 2. http://www.movable-type.co.uk/scripts/latlong-map.html?lat1=44.936905&long1=-91.392935&lat2=45.17614&long2=-93.87341 The reason is that we are calculating the box based on the fact that the upper right and lower left corners are 280KM away. The question is then, is this the intuitive thing app developers expect? If app developers think in terms of a radius of distance 280km and all points inside, then no, it isn't. But if they think in terms of the upper and lower box corners with no suggestion of "radius", hence implying a circle then it does. So, one fix for this could solely be a documentation fix. The other fix is to change the reasoning above to simply find the north, south, east, west points of a box that transcribes a radius of the distance given (since most users tend to think in terms of radius from where they are located and not upper and lower box corners. This will create a box that encloses said radius completely and might give a slight bit more fuzz up near the box corners due to curvature, but that should be fine. I'm working on a patch for this fix, as I think it is the better way. > 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