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

Public Member Functions

def __init__
 
def expression
 
def direction
 
def default_value
 
def __repr__
 

Static Public Attributes

tuple MAX_FIELD_VALUE = unichr(0x10ffff)
 
string MIN_FIELD_VALUE = u''
 

Detailed Description

Sort by a user specified scoring expression.

For example, the following will sort documents on a numeric field named
'length' in ascending order, assigning a default value of sys.maxint for
documents which do not specify a 'length' field.

  SortExpression(expression='length',
                 direction=sort.SortExpression.ASCENDING,
                 default_value=sys.maxint)

The following example will sort documents on a date field named
'published_date' in descending order, assigning a default value of
1999-12-31 for documents which do not specify a 'published_date' field.

  SortExpression(expression='published_date',
                 default_value=datetime.date(year=1999, month=12, day=31))

The following example will sort documents on a text field named 'subject'
in descending order, assigning a default value of '' for documents which
do not specify a 'subject' field.

  SortExpression(expression='subject')

Constructor & Destructor Documentation

def google.appengine.api.search.search.SortExpression.__init__ (   self,
  expression,
  direction = DESCENDING,
  default_value = '' 
)
Initializer.

Args:
  expression: An expression to be evaluated on each matching document
to sort by. The expression must evaluate to a text or numeric value.
The expression can simply be a field name, or some compound expression
such as "_score + count(likes) * 0.1" which will add the score from a
scorer to a count of the values of a likes field times 0.1. See
https://developers.google.com/appengine/docs/python/search/overview#Expressions
for a list of legal expressions.
  direction: The direction to sort the search results, either ASCENDING
or DESCENDING
  default_value: The default value of the expression. The default_value is
returned if expression cannot be calculated, for example, if the
expression is a field name and no value for that named field exists.
A text value must be specified for text sorts. A numeric value must be
specified for numeric sorts. A date value must be specified for date
sorts.

Raises:
  TypeError: If any of the parameters has an invalid type, or an unknown
attribute is passed.
  ValueError: If any of the parameters has an invalid value.
  ExpressionError: If the expression string is not parseable.

Member Function Documentation

def google.appengine.api.search.search.SortExpression.default_value (   self)
Returns a default value for the expression if no value computed.
def google.appengine.api.search.search.SortExpression.direction (   self)
Returns the direction to sort expression: ASCENDING or DESCENDING.
def google.appengine.api.search.search.SortExpression.expression (   self)
Returns the expression to sort by.

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