App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.api.search.search.Cursor Class Reference
Inheritance diagram for google.appengine.api.search.search.Cursor:

Public Member Functions

def __init__
 
def web_safe_string
 
def per_result
 
def __repr__
 

Detailed Description

Specifies how to get the next page of results in a search.

A cursor returned in a previous set of search results to use as a starting
point to retrieve the next set of results. This can get you better
performance, and also improves the consistency of pagination through index
updates.

The following shows how to use the cursor to get the next page of results:

# get the first set of results; the first cursor is used to specify
# that cursors are to be returned in the SearchResults.
results = index.search(Query(query_string='some stuff',
    QueryOptions(cursor=Cursor()))

# get the next set of results
results = index.search(Query(query_string='some stuff',
    QueryOptions(cursor=results.cursor)))

If you want to continue search from any one of the ScoredDocuments in
SearchResults, then you can set Cursor.per_result to True.

# get the first set of results; the first cursor is used to specify
# that cursors are to be returned in the SearchResults.
results = index.search(Query(query_string='some stuff',
    QueryOptions(cursor=Cursor(per_result=True)))

# this shows how to access the per_document cursors returned from a search
per_document_cursor = None
for scored_document in results:
  per_document_cursor = scored_document.cursor

# get the next set of results
results = index.search(Query(query_string='some stuff',
    QueryOptions(cursor=per_document_cursor)))

Constructor & Destructor Documentation

def google.appengine.api.search.search.Cursor.__init__ (   self,
  web_safe_string = None,
  per_result = False 
)
Initializer.

Args:
  web_safe_string: The cursor string returned from the search service to
be interpreted by the search service to get the next set of results.
  per_result: A bool when true will return a cursor per ScoredDocument in
SearchResults, otherwise will return a single cursor for the whole
SearchResults. If using offset this is ignored, as the user is
responsible for calculating a next offset if any.
Raises:

  ValueError: if the web_safe_string is not of required format.

Member Function Documentation

def google.appengine.api.search.search.Cursor.per_result (   self)
Returns whether to return a cursor for each ScoredDocument in results.
def google.appengine.api.search.search.Cursor.web_safe_string (   self)
Returns the cursor string generated by the search service.

The documentation for this class was generated from the following file: