rhefner1
rhefner1

Reputation: 464

App Engine Search API - Transient Error

I have an issue with the App Engine Full Text Search API throwing a TransientError. Here's the simplest form I could possibly make it (and it still gives the error on the production server, but not the dev). Note that this happens on all 5 of my search indexes, not just this one.

from google.appengine.api import search

query_obj = search.Query(query_string='')
print search.Index(name='donation').search(query=query_obj)

Here's the error that App Engine gives:

File "/base/data/home/apps/s~ghidonations/4e.365801633107307526/GlobalUtilities.py", line 914, in search
  search_results = search.Index(name=index_name).search(query=query_obj)
File "/python27_runtime/python27_lib/versions/1/google/appengine/api/search/search.py", line 3093, in search
  raise _ToSearchError(e)
TransientError

As I was writing this, some search queries actually started working again (that 5 minutes ago throw the error), but some are still goofy. I read on previous forums about sorting by date (which I do in the real production code), so I figured that taking it out would solve the problem. It didn't - see the 3 lines of code at the top.

Any idea what is causing this?

Upvotes: 1

Views: 1205

Answers (1)

bigblind
bigblind

Reputation: 12887

TransientErrors are errors that will go away in the future. I don't know what causes these errors, bug google recommends just retrying the search.

# Index the document.
try:
    index.put(doc)
except search.PutError, e:
    result = e.results[0]
    if result.code == search.OperationResult.TRANSIENT_ERROR:
        # possibly retry indexing result.object_id
except search.Error, e:
    # possibly log the failure

This example is from the Index.put documentation, but it's the only example of transient errors in the search api that I can find, so I expect you might be able to use the same technique.

source https://developers.google.com/appengine/docs/python/search/indexclass#Introduction

Upvotes: 3

Related Questions