birgire / geo-query

WordPress plugin: Geo Query - Modify the WP_Query/WP_User_Query to support the geo_query parameter. Uses the Haversine SQL implementation by Ollie Jones. With a Rest API example and support for an existing custom table .

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0 results when radius < 1

wujekbogdan opened this issue · comments

When radius is between 0 and 1 then the query doesn't give any results. Is it a bug, or is it a desired behavior?

Thanks @wujekbogdan,

Currently there's an integer parsing for the radius, with:

$groupby .= $this->db->prepare(
            " HAVING distance_value <= %d ",
            $this->radius
        );

but we can support floating point radius with:

$groupby .= $this->db->prepare(
            " HAVING distance_value <= %f ",
            $this->radius
        );

I will update this in the next version, with corresponding integration tests.

@birgire
It would be great. At the moment it's a bit misleading because GeoQueryHaversine->setup uses floatval to parse lat/lng/radius so it looks like floats are valid values not only for lat/lng but for the radius as well.

@wujekbogdan I agree,

This is should be fixed in version 0.0.6

Thanks again.

@birgire
Thanks a lot for a quick update!