Google Code offered in: English - Español - 日本語 - 한국어 - Português - Pусский - 中文(简体) - 中文(繁體)
Prospective Search is an experimental, innovative, and rapidly changing new feature for 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:
Decodes the document from a prospective search result POST request. Returns document, which is the db.Model document from the match() call.
Arguments:
POST request object received as a result of a match operation. Request is defined in google.appengine.ext.webapp.
Returns a tuple which contains the subscription ID, query, expiration time, and the state of a single subscription.
sub_id is the subscription ID.query is the query associated with the subscription.expiration_time is the number of seconds since the epoch when the subscription expires.state is one of:
Arguments:
document_class is a db.Model class name.subscribe() call, or the db.Model class name.Returns a list of tuples. Each tuple contains the subscription ID, query, expiration time, and the state of the subscription.
sub_id is the subscription ID.query is the query associated with the subscription.expiration_time is the number of seconds since the epoch when the subscription expires.state is one of:
Arguments:
db.Model.subscribe() call or the db.Model class name.Returns a list of topics as strings.
Arguments:
Matches a document with all subscribed queries on a specific topic and returns the results and db.Model document on the Task Queue. Results are subject to the Task Queue Quotas and Limits.
Arguments:
db.Model document.db.Model document. Only subscriptions to this topic are matched against this document.result_key can be used to identify document that is too large for the Task Queue to return. See Using Prospective Search.Register subscriptions using a subscription ID and a query. Expect a delay of a few seconds between when subscribe() returns successfully and when the subscription becomes registered and active. If a subscription with the same ID already exists, it is overwritten.
Arguments:
document_class is a db.Model class name.vanilla_query is a string or unicode query for documents of the type specified by document_class.sub_id is a unique string identifier for the subscription and is returned when the subscription is matched. subscribe() overwrites subscriptions with the same sub_id The size of the sub_id contributes to the size of the results, which are subject to the usual Task Queue Quotas and Limits.topic specifies the namespace for the subscriptions to match. In db.Model, topics are set to the document's class name by default.lease_duration_sec is the lifetime of the subscription. By default, this is set to 0 seconds and the subscription never expires.Remove a subscription. Expect a delay of a few seconds between when unsubscribe() returns successfully and when the subscription is removed and inactive. Once the last subscription for a given topic is removed, the topic also no longer exists.
Arguments:
document_class is class derived from db.Model.sub_id is the unique string identifier for the subscription to be removed.topic specifies the namespace for the subscriptions to unsubscribe. Topics are set to the document's class name if not explicitly specified.