View source on GitHub |
Represents a scored document returned from a search.
Inherits From: Document
, expected_type
google.appengine.api.search.ScoredDocument(
doc_id=None,
fields=None,
language='en',
sort_scores=None,
expressions=None,
cursor=None,
rank=None,
facets=None
)
Args | |
---|---|
doc_id
|
The visible printable ASCII string identifying the document which does not start with '!'. Whitespace is excluded from ids. If no id is provided, the search service will provide one. |
fields
|
An iterable of Field instances representing the content of the document. |
language
|
The code of the language used in the field values. |
sort_scores
|
The list of scores assigned during sort evaluation. Each sort dimension is included. Positive scores are used for ascending sorts; negative scores for descending. |
expressions
|
The list of computed fields which are the result of expressions requested. |
cursor
|
A cursor associated with the document. |
rank
|
The rank of this document. A rank must be a non-negative integer less than sys.maxint. If not specified, the number of seconds since 1st Jan 2011 is used. Documents are returned in descending order of their rank. |
facets
|
An iterable of Facet instances representing the facets for this document. |
Raises | |
---|---|
TypeError
|
If any of the parameters have invalid types, or an unknown attribute is passed. |
ValueError
|
If any of the parameters have invalid values. |
Attributes | |
---|---|
cursor
|
A cursor associated with a result, a continued search starting point.
To get this cursor to appear, set the Index.cursor_type to Index.RESULT_CURSOR, otherwise this will be None. |
doc_id
|
Returns the document identifier. |
expressions
|
The list of computed fields the result of expression evaluation.
For example, if a request has FieldExpression(name='snippet', 'snippet("good story", content)') meaning to compute a snippet field containing HTML snippets extracted from the matching of the query 'good story' on the field 'content'. This means a field such as the following will be returned in expressions for the search result: HtmlField(name='snippet', value='that was a good story to finish') |
facets
|
Returns a list of facets of the document. |
fields
|
Returns a list of fields of the document. |
language
|
Returns the code of the language the document fields are written in. |
rank
|
Returns the rank of this document. |
sort_scores
|
Deprecated: the list of scores assigned during sort evaluation.
The right way to retrieve a score is to use '_score' in a FieldExpression. |
Methods
facet
facet(
facet_name
)
Returns list of facets with the provided name.
Args | |
---|---|
facet_name
|
The name of the facet to return. |
Returns | |
---|---|
A list of facets with the given name. |
field
field(
field_name
)
Returns the field with the provided field name.
Args | |
---|---|
field_name
|
The name of the field to return. |
Returns | |
---|---|
A field with the given name. |
Raises | |
---|---|
ValueError
|
There is not exactly one field with the given name. |
__eq__
__eq__(
other
)
Return self==value.
__getitem__
__getitem__(
field_name
)
Returns a list of all fields with the provided field name.
Args | |
---|---|
field_name
|
The name of the field to return. |
Returns | |
---|---|
All fields with the given name, or an empty list if no field with that name exists. |
__iter__
__iter__()
Documents do not support iteration.
This is provided to raise an explicit exception.
__ne__
__ne__(
other
)
Return self!=value.