Google app engine 使用ndb端点\u原型\u数据存储进行全文搜索

Google app engine 使用ndb端点\u原型\u数据存储进行全文搜索,google-app-engine,google-cloud-endpoints,endpoints-proto-datastore,Google App Engine,Google Cloud Endpoints,Endpoints Proto Datastore,我一直在使用endpoints_proto_数据存储库来构建我的endpoints API,我试图找出如何返回从搜索API检索到的记录结果列表 @query\u方法似乎需要返回一个查询类型,它将在内部执行fetch调用。我将如何实现处理全文搜索的端点方法?我是否只定义一个定制的protorpc请求消息和响应消息,并跳过端点proto_数据存储库 这是我尝试过的,但得到了一个错误,列表没有ToMessage属性 Encountered unexpected error from ProtoRPC

我一直在使用endpoints_proto_数据存储库来构建我的endpoints API,我试图找出如何返回从搜索API检索到的记录结果列表

@query\u方法似乎需要返回一个查询类型,它将在内部执行fetch调用。我将如何实现处理全文搜索的端点方法?我是否只定义一个定制的protorpc请求消息和响应消息,并跳过端点proto_数据存储库

这是我尝试过的,但得到了一个错误,列表没有ToMessage属性

Encountered unexpected error from ProtoRPC method implementation: AttributeError ('list' object has no attribute 'ToMessage')
Traceback (most recent call last):
  File "google_appengine/lib/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app
    response = method(instance, request)
  File "google_appengine/lib/endpoints-1.0/endpoints/api_config.py", line 1329, in invoke_remote
    return remote_method(service_instance, request)
  File "google_appengine/lib/protorpc-1.0/protorpc/remote.py", line 412, in invoke_remote_method
    response = method(service_instance, request)
  File "third_party/py/endpoints_proto_datastore/ndb/model.py", line 1416, in EntityToRequestMethod
    response = response.ToMessage(fields=response_fields)
AttributeError: 'list' object has no attribute 'ToMessage'
以下是代码的总体视图:

class MyModel(EndpointsModel):
  SearchSchema = MessageFieldsSchema(('q',))

  _query_string = None

  def QueryStringSet_(self, value):
    self._query_string = value

  @EndpointsAliasProperty(name='q', setter=QueryStringSet_)
  def query_string(self):
    return self._query_string


class MyServices(...):
  @MyModel.method(
      request_fields=MyModel.SearchSchema,
      name='search', path='mymodel/search')
  def SearchMyModel(self, request):
    return MyModel.Search(request.q)

如果您使用的是Java,那么答案就是使用

 import com.google.api.server.spi.response.CollectionResponse;
在python中,您需要创建