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.Query Class Reference
Inheritance diagram for google.appengine.api.search.search.Query:

Public Member Functions

def __init__
 
def query_string
 
def options
 

Detailed Description

Represents a request on the search service to query the index.

Constructor & Destructor Documentation

def google.appengine.api.search.search.Query.__init__ (   self,
  query_string,
  options = None 
)
Initializer.

For example, the following code fragment requests a search for
documents where 'first' occurs in subject and 'good' occurs anywhere,
returning at most 20 documents, starting the search from 'cursor token',
returning another single document cursor for the results, sorting by
subject in descending order, returning the author, subject, and summary
fields as well as a snippeted field content.

  results = index.search(Query(
  query_string='subject:first good',
  options=QueryOptions(
      limit=20,
      cursor=Cursor(),
      sort_options=SortOptions(
          expressions=[
              SortExpression(expression='subject')],
          limit=1000),
      returned_fields=['author', 'subject', 'summary'],
      snippeted_fields=['content'])))

In order to get a Cursor, you specify a Cursor in QueryOptions.cursor
and extract the Cursor for the next request from results.cursor to
continue from the last found document, as shown below:

  results = index.search(
  Query(query_string='subject:first good',
        options=QueryOptions(cursor=results.cursor)))

Args:
  query_string: The query to match against documents in the index. A query
is a boolean expression containing terms.  For example, the query
  'job tag:"very important" sent <= 2011-02-28'
finds documents with the term job in any field, that contain the
phrase "very important" in a tag field, and a sent date up to and
including 28th February, 2011.  You can use combinations of
  '(cat OR feline) food NOT dog'
to find documents which contain the term cat or feline as well as food,
but do not mention the term dog. A further example,
  'category:televisions brand:sony price >= 300 price < 400'
will return documents which have televisions in a category field, a
sony brand and a price field which is 300 (inclusive) to 400
(exclusive).  See
https://developers.google.com/appengine/docs/python/search/overview#Expressions
for a list of expressions that can be used in queries.
  options: A QueryOptions describing post-processing of search results.
Raises:
  QueryError: If the query string is not parseable.

Member Function Documentation

def google.appengine.api.search.search.Query.options (   self)
Returns QueryOptions defining post-processing on the search results.
def google.appengine.api.search.search.Query.query_string (   self)
Returns the query string to be applied to search service.

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