[英]AppEngine Full Search API Location Distance
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?
知道发生了什么吗?
PS I only tried this on development server. PS我只在开发服务器上尝试过。
UPDATE: Just deployed and it is working just fine on production. 更新:刚刚部署,并且在生产中运行正常。 Still not sure why it doesn't work on Development.
仍然不确定为什么它不适用于开发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.