toastdriven/django-haystack — pull request #1042 by KevinBrolly (2014-08-05 23:02:06+00:00)
Title: Changed the geo_distance filter distance attribute

Changed the geo_distance filter distance attribute to have a specified unit for distance. From the elasticsearch docs (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/common-options.html#distance-units) if a specific distance unit is not provided such as "1km" or "2mi" then the default unit is the meter. However in version 0.90 this was incorrectly documented and the default unit was actually [kilometers](https://github.com/elasticsearch/elasticsearch/blob/v0.90.13/src/main/java/org/elasticsearch/index/query/GeoDistanceFilterParser.java#L76)

This meant that haystack still worked even though this was technically an elasticsearch bug. However in elasticsearch 1.0 the problem has been [fixed](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/GeoDistanceFilterParser.java#L76) and the default of meters has been correctly implemented, meaning that when haystack passes in a km value without unit it is interpreted by ES as meters and is therefore wrong.

I have changed distance so that it actually passes in km units as per haystacks documentation.