I am trying to get to get nearby documents working. I followed the documentation but the distance location is returning empty result and not sure why. This is what I am doing:
Indexing documents:
fields = [
search.GeoField(name='location', value=search.GeoPoint(lat, lng)),
...
]
doc = search.Document(fields=fields)
add_result = search.Index(name=INDEX_NAME).put(doc)
Search query:
query_string = 'distance(location, geopoint({}, {})) < {}'.format(lat, lng, 5000)
query = search.Query(query_string=query_string)
results = index.search(query)
But this is returning empty result. I've also tried running the query directly from the admin interface but no luck. I am pretty sure the query should return something. Tried large distances to make sure it should work but still nothing. Any idea what is happening?
P.S. I only tried this on development server.
UPDATE: Just deployed and it is working just fine on production. Still not sure why it doesn't work on Development.