fromgoogle.appengine.apiimportsearchsearch.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')
引數
doc_id
「文件識別碼」,為使用者可判讀的 ASCII 字串,用於識別文件。不得包含空白字元,且開頭不得為驚嘆號 (!)。如果省略,搜尋服務會提供 ID 字串。
在大多數情況下,您不需要明確指定文件識別碼,但在實作其他儲存機制 (例如 Blobstore 或 Google Storage) 的搜尋功能時,指定自訂識別碼會很實用。以 Blobstore 為例,您可以將文件 ID 設為 BlobKey,建立該文件與特定 blob 的關聯。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-05-30 (世界標準時間)。"],[[["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."]]],[]]