生产中的全文搜索错误,但不是暂存

时间:2015-08-06 21:00:33

标签: google-app-engine full-text-search

在谷歌应用引擎中,我正在运行全文搜索,其中生成的完全相同的代码与暂存相同。唯一的区别是数据库中的数据。

暂存环境运行完美,但生产环境。给我以下错误:

  File "<mydir>/mycode.py", line 51, in get
    search_result = lnp_index.search(query)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 105, in positional_wrapper
    return wrapped(*args, **kwds)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/search/search.py", line 3676, in search
    return self.search_async(query, deadline=deadline, **kwargs).get_result()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/search/search.py", line 262, in get_result
    return self._get_result_hook()
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/search/search.py", line 3690, in hook
    _CheckStatus(response.status())
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/search/search.py", line 517, in _CheckStatus
    raise _ERROR_MAP[status.code()](status.error_detail())
InvalidRequest: Failed to execute search request "4597385989193728"

我调用搜索的代码如下所示:

query_str = self.request.get('query') or self.request.get('did')
limit = int(self.request.get('limit', 50))
prev_cursor = self.request.get('cursor', None)
expr_list = [
    fts.SortExpression(expression='created_date',
                       default_value=1,
                       direction=fts.SortExpression.DESCENDING),
]
sort_opts = fts.SortOptions(expressions=expr_list, limit=limit)
cursor_obj = fts.Cursor(web_safe_string=prev_cursor) if prev_cursor and prev_cursor != "None" else fts.Cursor()
query_options = fts.QueryOptions(limit=limit, cursor=cursor_obj, sort_options=sort_opts)
lnp_index = fts.Index(name=constants.FTS_LNP_INDEX)
query = fts.Query(query_string=full_query_str, options=query_options)
search_result = lnp_index.search(query)

光标就像这样生成并发送到网络(将它发送回params):

cursor = search_result.cursor.web_safe_string if search_result.cursor else None

导致这种情况的原因是什么?

0 个答案:

没有答案