Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



class ScoredDocument

Class ScoredDocument represents a scored document returned from a search. You do not build this class explicitly; rather, it is returned as a result of Index.search() .

ScoredDocument is defined in the google.appengine.api.search module.

  1. Constructor
  2. Properties:

Constructor

The constructor for class MatchScorer is defined as follows:

class ScoredDocument ( doc_id = None
, fields = None , language = 'en' , sort_scores = None , expressions = None , cursor = None , rank = None )

Represents a scored document returned from a search.

Arguments

doc_id

The visible, printable ASCII string identifying the document. Must not begin 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 two-letter ISO 639.2 language 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 document rank is used to specify the order this document will be returned in search results, where 0 <= rank <= sys.maxint. If not specified, the number of seconds since 1st Jan 2011 is used. Documents are returned in descending order of the order ID.

Result value

A new instance of class ScoredDocument .

Exceptions

TypeError

If any of the parameters have an invalid type, or an unknown attribute is passed.

ValueError

If any parameter has an invalid value.

Properties

An instance of class ScoredDocument has the following properties:

sort_scores

Returns the list of scores assigned while the API is sorting the results of a search. Each sort dimension is included. Positive scores are used for ascending sorts and negative scores for descending.

expressions

The list of computed fields the result of expression evaluation. For example, the following field expression seeks to compute a snippet field containing HTML snippets extracted from the matching of the query 'good story' in the content field:

FieldExpression(name='snippet', 'snippet("good story", content)')
Given this query, the API would return the following ScoredDocument.expression :
HtmlField(name='snippet', value='that was a good story to finish')

cursor

A cursor associated with a result used as a starting point from which to return the next set of search results. This property will not return unless you set the Index.cursor_type to Index.RESULT_CURSOR ; otherwise the property returns be None .

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.