Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
GetResponse クラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
GetResponse
クラスは、ドキュメントとインデックスに関する情報を返すために呼び出されたメソッドの結果を表します。
GetResponse
は、google.appengine.api.search
モジュールで定義されます。
はじめに
GetResponse
オブジェクトは、index.get_range() または search.get_indexes() の呼び出しから返されます。GetResponse
のインスタンスを反復処理すると、その results プロパティのメンバーが返されます。プロパティの内容は、GetResponse
のインスタンスを作成した呼び出しの種類によって決まります。
たとえば、次のコードは GetResponse
を使用して正常に削除されたドキュメントを特定する方法を示しています。この場合、反復処理によって複数のドキュメントが返されます。
response = index.get_range()
for document in response:
print "document ", document
コンストラクタ
GetResponse
クラスのコンストラクタは、次のように定義されます。
- class GetResponse(results=None)
クラス GetResponse
のインスタンスを作成します。
引数
- results
results
プロパティの初期値。
結果値
GetResponse
クラスの新しいインスタンス。
例外
- TypeError
パラメータの型が無効であるか、不明な属性が渡されました。
- ValueError
パラメータの値が無効です。
プロパティ
GetResponse
クラスのインスタンスには次のプロパティがあります。
- results
オブジェクトを返す呼び出しに応じて型が異なる結果のリスト。get_range() が呼び出された場合、識別子の降順で並び替えられたドキュメントのリストが results
として返されます。search.get_indexes() が呼び出された場合、インデックスのリストが results
として返されます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","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-09-04 UTC。"],[[["\u003cp\u003e\u003ccode\u003eGetResponse\u003c/code\u003e represents the results obtained from methods that retrieve information about documents and indexes, particularly in the context of first-generation runtimes and potential migration to second-generation runtimes.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eGetResponse\u003c/code\u003e object is returned by \u003ccode\u003eindex.get_range()\u003c/code\u003e or \u003ccode\u003esearch.get_indexes()\u003c/code\u003e, allowing iteration over the \u003ccode\u003eresults\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetResponse\u003c/code\u003e class can be initialized with a \u003ccode\u003eresults\u003c/code\u003e parameter using the constructor \u003ccode\u003eGetResponse(results=None)\u003c/code\u003e, and it raises \u003ccode\u003eTypeError\u003c/code\u003e or \u003ccode\u003eValueError\u003c/code\u003e for invalid inputs.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eresults\u003c/code\u003e property of a \u003ccode\u003eGetResponse\u003c/code\u003e instance is a list, which either contains \u003ccode\u003eDocuments\u003c/code\u003e when returned from \u003ccode\u003eget_range()\u003c/code\u003e or contains \u003ccode\u003eIndexes\u003c/code\u003e when returned from \u003ccode\u003eget_indexes()\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# The GetResponse Class\n\nClass `GetResponse` represents\nthe results of methods invoked to return information about documents and indexes.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\n`GetResponse` is defined in the module `google.appengine.api.search`.\n\nIntroduction\n------------\n\nA `GetResponse` object is returned from a call to either\n[index.get_range()](/appengine/docs/legacy/standard/python/search/indexclass#Index_get_range)\nor\n[search.get_indexes()](/appengine/docs/legacy/standard/python/search/functions#get_indexes).\nYou can iterate over an instance of\n`GetResponse`, which will return the members of its\n[results](#GetResponse_results) property. The contents of the property\nare determined by the type of call that created the instance of `GetResponse`.\n\nFor example, the following code shows how `GetResponse` could be used to\ndetermine which documents were successfully deleted. In this case\nthe iteration returns\n[Documents](/appengine/docs/legacy/standard/python/search/documentclass). \n\n```python\nresponse = index.get_range()\nfor document in response:\n print \"document \", document\n```\n\nConstructor\n-----------\n\nThe constructor for class `GetResponse` is defined as follows:\n\n\nclass GetResponse(results=None)\n\n:\n\n Construct an instance of class `GetResponse`.\n\n \u003cbr /\u003e\n\n:\n\n **Argument**\n\n results\n\n : Initial value of its `results` property.\n\n Result value\n\n : A new instance of class `GetResponse`.\n\n Exceptions\n\n TypeError\n\n : A parameter has an invalid type, or an unknown attribute was passed.\n\n ValueError\n\n : A parameter has an invalid value.\n\n \u003cbr /\u003e\n\nProperties\n----------\n\nAn instance of class `GetResponse` has the following property:\n\nresults\n\n: A list of results, whose type depends on the call that returns the\n object. If returning from a call to\n [get_range()](/appengine/docs/legacy/standard/python/search/indexclass#Index_get_range),\n `results` is a list of [Documents](/appengine/docs/legacy/standard/python/search/documentclass)\n in descending order of their identifiers. If returning from a call to\n [search.get_indexes()](/appengine/docs/legacy/standard/python/search/functions#get_indexes),\n `results` is a list of\n [Indexes](/appengine/docs/legacy/standard/python/search/indexclass)."]]