0

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.

mkhatib
  • 5,089
  • 2
  • 26
  • 35
  • 1
    http://stackoverflow.com/questions/15616200/why-is-geosearching-location-based-searches-returning-zero-results – Sap Nov 07 '13 at 12:14

1 Answers1

0

As I indicated earlier and as mentioned in the comment by @Sap above, it is how Geo Search work on the development server.

Community
  • 1
  • 1
mkhatib
  • 5,089
  • 2
  • 26
  • 35