I recently noticed that the 'full text search' feature of my app was
throwing a stacktrace like this:
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 503, in __call__
handler.post(*groups)
File "/base/data/home/apps/shell-sink/2.331785781902411868/
shellsink.py", line 191, in post
commands = full_text_search(sysadmin, query, paging_helper.page)
File "/base/data/home/apps/shell-sink/2.331785781902411868/
command.py", line 55, in full_text_search
return query.fetch(Command.COMMANDS_PER_PAGE, (page - 1) *
Command.COMMANDS_PER_PAGE)
File "/base/python_lib/versions/1/google/appengine/ext/db/
__init__.py", line 1426, in fetch
raw = self._get_query().Get(limit, offset)
File "/base/python_lib/versions/1/google/appengine/api/
datastore.py", line 964, in Get
return self._Run(limit, offset)._Next(limit)
File "/base/python_lib/versions/1/google/appengine/api/
datastore.py", line 905, in _Run
apiproxy_stub_map.MakeSyncCall('datastore_v3', 'RunQuery', pb,
result)
File "/base/python_lib/versions/1/google/appengine/api/
apiproxy_stub_map.py", line 68, in MakeSyncCall
apiproxy.MakeSyncCall(service, call, request, response)
File "/base/python_lib/versions/1/google/appengine/api/
apiproxy_stub_map.py", line 240, in MakeSyncCall
stub.MakeSyncCall(service, call, request, response)
File "/base/python_lib/versions/1/google/appengine/runtime/
apiproxy.py", line 181, in MakeSyncCall
rpc.MakeCall(package, call, request, response)
File "/base/python_lib/versions/1/google/appengine/api/
apiproxy_rpc.py", line 92, in MakeCall
self._MakeCallImpl()
File "/base/python_lib/versions/1/google/appengine/runtime/
apiproxy.py", line 124, in _MakeCallImpl
self.request.Output(e)
File "/base/python_lib/versions/1/google/net/proto/
ProtocolBuffer.py", line 162, in Output
raise ProtocolBufferEncodeError, '\n\t'.join(dbg)
ProtocolBufferEncodeError: Required field: multiple not set.
I am using a gently modified version of SearchableModel in my app so I
immediately suspected some change in the db.Model super class. It
looks like the following line was added to the _ToPb method of
SearchableQuery: prop.set_multiple(len(keywords) > 1)
I applied the following patch to my custom SearchableModel and it
works fine again.
232a263
> prop.set_multiple(len(keywords) > 1)
237a269,286
> class SearchableMultiQuery(datastore.MultiQuery):
> """A multiquery that supports Search() by searching subqueries."""
>
> def Search(self, *args, **kwargs):
> """Add a search query, by trying to add it to all subqueries.
>
> Args:
> args: Passed to Search on each subquery.
> kwargs: Passed to Search on each subquery.
>
> Returns:
> self for consistency with SearchableQuery.
> """
> for q in self:
> q.Search(*args, **kwargs)
> return self
>
>
264c312,314
< query = db.Query._get_query(self,
_query_class=SearchableQuery)
---
> query = db.Query._get_query(self,
> _query_class=SearchableQuery,
> _multi_query_class=SearchableMultiQuery)
Thought I would post just in case anyone else runs into it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---