我正在尝试按日期字段运行查询和排序。
q = self.request.get("q")
index = search.Index(name="transaction")
sort_options = search.SortOptions(
expressions=[
search.SortExpression(expression='timestamp_date', direction=search.SortExpression.DESCENDING)
],
limit=1000)
options = search.QueryOptions(limit=30, cursor=search.Cursor(), sort_options=sort_options)
results = index.search(search.Query(query_string=q, options=options))
在开发服务器上,代码有效,但结果未正确排序。在生产服务器上它根本不起作用;它给出了以下错误:
Search failed
Traceback (most recent call last):
File "/base/data/home/apps/s~xxx/pre-24.359846149527858049/main.py", line 78, in get
results = index.search(search.Query(query_string=q, options=options))
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/search/search.py", line 2609, in search
_CheckStatus(response.status())
File "/base/python27_runtime/python27_lib/versions/1/google/appengine/api/search/search.py", line 414, in _CheckStatus
raise _ERROR_MAP[status.code()](status.error_detail())
TransientError
我想知道如何使它在生产服务器上工作以及如何在开发服务器上正确排序。我知道它的实验技术,但我想看看这是否是我忽略的东西