A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/appengine/docs/legacy/standard/python/search/documentclass below:

The Document Class | App Engine standard environment for Python 2

The Document Class

Stay organized with collections Save and categorize content based on your preferences.

Class Document represents a document containing searchable content.

This API is supported for first-generation runtimes and can be used when upgrading to corresponding second-generation runtimes. If you are updating to the App Engine Python 3 runtime, refer to the migration guide to learn about your migration options for legacy bundled services.

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

Constructor

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 Document.

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')

Arguments

doc_id

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 BlobKey in order to associate that document with a specific blob.

fields

An iterable collection of Field objects representing the content of the document.

language

A two-letter ISO 693-1 code for the language in which the document's field values are expressed.

rank

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 _rank.

Result value

A new instance of class Document.

Exceptions

TypeError

A parameter has an invalid type or an unknown attribute was passed.

ValueError

A parameter has an invalid value.

Properties

An instance of class Document has the following properties:

doc_id

The document identifier, a human-readable ASCII string identifying the document.

fields

A list of the document's fields.

language

The two-letter ISO 693-1 code for the language in which the document's field values are expressed.

rank

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.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["The `Document` class represents a searchable document and is defined within the `google.appengine.api.search` module."],["You can construct a `Document` instance by specifying a `doc_id`, an iterable collection of `Field` objects, the language of the document, and an optional rank for search result ordering."],["The `doc_id` is a unique identifier for the document, and if not provided, the search service will automatically assign one."],["The `rank` property determines the document's order in search results, with newer documents returned first, and if not specified, defaults to seconds since January 1, 2011."],["The document language can be defined by the use of a two-letter [ISO 693-1](https://iso639-3.sil.org/) code."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4