Experimental!
Prospective Search is an experimental, innovative, and rapidly changing new feature for Google App Engine. Unfortunately, being on the bleeding edge means that we may make backwards-incompatible changes to Prospective Search. We will inform the community when this feature is no longer experimental.
The
google.appengine.api.prospective_search
package provides the following functions:
- get_document ( request )
-
Decodes the document from a prospective search result
POSTrequest. Returnsdocument, which is thedb.Modeldocument from the match() call.Arguments
- request
-
POSTrequest object received as a result of a match operation. Request is defined inwebapp2.
- get_subscription ( document_class , sub_id , topic = None )
-
Returns a tuple which contains the subscription ID, query, expiration time, and the state of a single subscription.
-
sub_idis the subscription ID. -
queryis the query associated with the subscription. -
expiration_timeis the number of seconds since the epoch when the subscription expires. -
stateis one of:- SubscriptionState.OK – Subscription is active.
- SubscriptionState.PENDING – Successfully registered but not yet active.
- SubscriptionState.ERROR – Inactive due to an error. (See the error value for explanation.)
Arguments
- document_class
-
document_classis adb.Modelclass name. - sub_id
- Subscription ID to be retrieved.
- topic
-
The topic name explicitly specified in the
subscribe()call, or thedb.Modelclass name.
-
- list_subscriptions ( document_class , sub_id_start = '' , topic = None , max_results = 1000 , expires_before = None )
-
Returns a list of tuples. Each tuple contains the subscription ID, query, expiration time, and the state of the subscription.
-
sub_idis the subscription ID. -
queryis the query associated with the subscription. -
expiration_timeis the number of seconds since the epoch when the subscription expires. -
stateis one of:- SubscriptionState.OK – Subscription is active.
- SubscriptionState.PENDING – Successfully registered but not yet active.
- SubscriptionState.ERROR – Inactive due to an error (see error value for explanation).
Arguments
- document_class
-
A class derived from
db.Model. - sub_id_start
- Limits the returned subscriptions to those that are lexicographically equal to or greater than the specified value.
- topic
-
The topic name explicitly specified in the
subscribe()call or thedb.Modelclass name. - max_results
- Sets the maximum number of subscriptions to return.
- expires_before
- Limits the returned subscriptions to those that expire before the specified time.
-
- list_topics ( max_results = 1000 , topic_start = None )
-
Returns a list of topics as strings.
Arguments
- max_results
- Specifies the maximum number of topics to return.
- topic_start
- Limits the returned topics to those whose names are lexicographically equal to or greater than the specified value.
- match ( document , topic = None , result_key = None , result_relative_url = '/_ah/prospective_search' , result_task_queue = 'default' , result_batch_size = 100 , result_return_document = True )