简体   繁体   English

Google App Engine Python搜索Api的基于位置的查询(Geosearch)问题

[英]Google App Engine Python Search Api's Location-based queries (Geosearch) Issues

I have implemented GAE's Python Search Api and am trying to query based on distance from given geopoint. 我已经实现了GAE的Python Search Api,并尝试根据距给定地理位置的距离进行查询。

My query string is: "distance(location, geopoint(XXX, YYY)) < ZZZ". 我的查询字符串是:“ distance(location,geopoint(XXX,YYY))<ZZZ”。 However, for some reason on the production server, this query string is returning items where the distance is greater than the ZZZ parameter. 但是,由于生产服务器上的某些原因,此查询字符串将返回距离大于ZZZ参数的项目。

Below are actual numbers (production) demonstrating the inaccuracies: 以下是显示错误的实际数字(生产):

Actual Distance: 343.9m 实际距离:343.9m
Query Distance that still gets the result: 325m 仍然得到结果的查询距离:325m

Actual Distance: 18,950.3 实际距离:18,950.3
Query Distance that still gets the result: 13,499m 仍然得到结果的查询距离:13,499m

Actual Distance: 55,979.0 实际距离:55,979.0
Query Distance that still gets the result: 44,615m 仍然得到结果的查询距离:44,615m

Actual Distance: 559,443.6 实际距离:559,443.6
Query Distance that still gets the result: 451,167m 仍然得到结果的查询距离:451,167m

Actual Distance: 53.4 实际距离:53.4
Query Distance that still gets the result: 46m 仍然得到结果的查询距离:46m

Actual Distance: 35,322.2 实际距离:35,322.2
Query Distance that still gets the result: 30,808m 仍然得到结果的查询距离:30,808m

Actual Distance: 190.2 实际距离:190.2
Query Distance that still gets the result: 143m 仍然得到结果的查询距离:143m

On my development server, these inaccuracies do not exist. 在我的开发服务器上,这些错误不存在。 I am able to query down to the exact meter and get the expected results. 我能够查询到准确的仪表并获得预期的结果。

What could cause this and how to fix it so that I get accurate query results in production? 是什么原因造成的,以及如何解决它,以便在生产中获得准确的查询结果? Is anyone else getting the same issue? 还有其他人遇到同样的问题吗?

There can be two reasons for this : 可能有两个原因:

1 - miles instead of km 1-英里代替km

2 - conversion numbers (for example 35,322.2 is 35322.2 ? km ? miles ?) i suggest to check what exactly are the numbers processed when executing distance function, you can programmatically output this data in some logs 2-转换数字(例如35,322.2是35322.2?km?英里?)我建议检查执行距离功能时要处理的数字到底是什么,您可以以编程方式将此数据输出到一些日志中

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM