为什么地理搜索/基于位置的搜索返回零结果? [英] Why is geosearching/location based searches returning zero results?

查看:124
本文介绍了为什么地理搜索/基于位置的搜索返回零结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用应用引擎的搜索API来搜索位置:
https://developers.google.com/appengine/docs/python/search/overview#Performing_Location-Based_Searches



问题是无论我做什么,我都会得到零结果。我将搜索lat / lng设置为文档的GeoPoint属性上的确切点,它仍然返回零。



我知道常规搜索正在工作,因为如果我更改查询是一个常规的全文搜索,它的工作原理。



这里是我的数据的一个例子(这实际上来自示例应用程序: http://www.youtube.com/watch?v=cE6gb5pqr1k

 全文搜索> stores1 
文件ID:sanjose
字段名称字段值
store_address 123主要
store_location search.GeoPoint(纬度= 37.37,经度= -121.92)
store_name San Jose

然后我的查询:

  index = search.Index('stores1')
loc =(37.37,-121.92)
query =distance(store_location,geopoint(37.37,-121.92)) < 4500
loc_expr =distance(store_location,geopoint(37.37,-121.92))
sortexpr = search.SortExpression(
expression = loc_expr,
direction = search。 SortExpression.ASCENDING,default_value = 4501)
search_query = search.Query(
query_string = query,
options = search.QueryOptions(
sort_options = search.SortOptions(expressions = [sortexpr ])))

results = index.search(search_query)
打印结果

以及退货:

  search.SearchResults(number_found = 0L)

我错过了什么或做错了什么?这应该至少返回一个结果,对吗?

** UPDATE **



/搜索/测试我认为这可能是一个关于谷歌应用程序引擎开发服务器的错误。



如果我在生产环境中的相同数据上运行位置搜索,预期成绩。当我在开发环境中比较和运行完全相同的数据查询时,我得到了意想不到的0结果。



如果有人对此有所了解,请告知。否则,对于那些遇到同样问题的人,我在应用引擎问题跟踪器
这里

解决方案

您可能已经知道了这一点,但如果有人遇到这篇文章,AppEngine Search API的地理特征功能在开发服务器上返回零结果。从 https://developers.google.com/appengine/training/fts_intro/lesson2

...开发Web服务器(本地运行)不完全支持某些搜索查询,因此您需要使用



以下是另一个有用的链接:
https://developers.google.com/appengine/docs/python/search/devserver


I am trying to use app engine's search API to search locations: https://developers.google.com/appengine/docs/python/search/overview#Performing_Location-Based_Searches

The problem is no matter what I do, I get zero results. I set the search lat/lng as the the exact point on a document's GeoPoint property and it still returns zero.

I know the regular search is working because if I change the query to be a regular full-text search, it works.

Here is an example of my data (this is actually from the example app here: http://www.youtube.com/watch?v=cE6gb5pqr1k)

Full Text Search > stores1
Document Id: sanjose
Field Name  Field Value
store_address   123 Main St.
store_location  search.GeoPoint(latitude=37.37, longitude=-121.92)
store_name  San Jose 

And then my query:

index = search.Index('stores1')
loc = (37.37, -121.92)
query = "distance(store_location, geopoint(37.37, -121.92)) < 4500"
loc_expr = "distance(store_location, geopoint(37.37, -121.92))"
sortexpr = search.SortExpression(
   expression=loc_expr,
   direction=search.SortExpression.ASCENDING, default_value=4501)
search_query = search.Query(
   query_string=query,
   options=search.QueryOptions(
     sort_options=search.SortOptions(expressions=[sortexpr])))

results = index.search(search_query)
print results 

And the returns:

search.SearchResults(number_found=0L)

Am I missing something or doing something wrong? This should return at least that one result, right?

** UPDATE **

After doing some prying/searching/testing I think this may be a bug regarding the google app engine development server.

If I run location searches on the same data in the production environment, I get expected results. When I compare and run the exact same query on the data in the development environment, I get the unexpected 0 results.

If anybody has any insight on this, please advise. Otherwise, for those of you seeing the same problem, I created an issue on app engine's issue tracker here.

解决方案

You've probably already figured this out, but in case someone comes across this post, the geosearch feature of AppEngine's Search API returns zero results on the dev server. From https://developers.google.com/appengine/training/fts_intro/lesson2:

"...some search queries are not fully supported on the Development Web Server (running locally), so you’ll need to run them using a deployed application."

Here's another useful link: https://developers.google.com/appengine/docs/python/search/devserver

这篇关于为什么地理搜索/基于位置的搜索返回零结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆