Document represents a document containing searchable content.
Document is defined in the module
The constructor for class
Document is defined as follows:
- class Document(doc_id=None, fields=None, language='en', rank=None)
Construct an instance of class
The following example shows how to create a document consisting of a set of fields, some plain text and one in HTML:
from google.appengine.api import search search.Document( doc_id='documentId', fields=[search.TextField(name='subject', value='going for dinner'), search.HtmlField(name='body', value='<html>I found a place.</html>'), search.TextField(name='signature', value='brzydka pogoda', language='pl')], language='en')
The document identifier, a human-readable ASCII string identifying the document. Must contain no whitespace characters and not start with an exclamation point (
!). If omitted, the search service will provide an identifier string.
In most cases, you do not need to specify the document identifier explicitly. Specifying your own identifier is useful, however, for implementing search with other storage mechanisms, such as Blobstore or Google Storage. In the case of Blobstore, for example, you can set the document identifier to the
BlobKeyin order to associate that document with a specific blob.
An iterable collection of
Fieldobjects representing the content of the document.
A two-letter ISO 693-1 code for the language in which the document's field values are expressed.
The document's rank, an integer specifying the order in which it will be returned in search results. Newer documents are returned first. If not specified the rank will be set to the number of seconds since 1 January 2011 00:00:00 UTC. Note that when rank is used in a FieldExpression or SortExpression it is referenced as
A new instance of class
A parameter has an invalid type or an unknown attribute was passed.
A parameter has an invalid value.
An instance of class
Document has the following properties:
The document identifier, a human-readable ASCII string identifying the document.
A list of the document's fields.
The two-letter ISO 693-1 code for the language in which the document's field values are expressed.
The document's rank, an integer specifying the order in which it will be returned in search results. Note that when rank is used in a FieldExpression or SortExpression it is referenced as
_rank. Also, if you create a SortExpression that includes rank as one of the sort keys, rank can only be sorted in the DESCENDING direction.