View source on GitHub |
Represents a multi-dimensional sort of Documents.
Inherits From: expected_type
google.appengine.api.search.SortOptions(
expressions=None, match_scorer=None, limit=1000
)
The following code shows how to sort documents based on product rating in descending order and then cheapest product within similarly rated products, sorting at most 1000 documents:
SortOptions(expressions=[ SortExpression(expression='rating', direction=SortExpression.DESCENDING, default_value=0), SortExpression(expression='price + tax', direction=SortExpression.ASCENDING, default_value=999999.99)], limit=1000)
Args | |
---|---|
expressions
|
An iterable of SortExpression representing a multi-dimensional sort of Documents. |
match_scorer
|
A match scorer specification which may be used to score documents or in a SortExpression combined with other features. |
limit
|
The limit on the number of documents to score or sort. |
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. |
Attributes | |
---|---|
expressions
|
A list of SortExpression specifying a multi-dimensional sort. |
limit
|
Returns the limit on the number of documents to score or sort. |
match_scorer
|
Returns a match scorer to score documents with. |