SortOptions クラス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
SortExpression
クラスは、ドキュメントの多次元の並べ替えを表します。
次のコードは、ドキュメントを製品の評価の降順に並べ替えます。評価が同等の製品は、価格が低い順に並べ替えます。最大で 1,000 個のドキュメントを並べ替えます。
SortOptions(expressions=[
SortExpression(expression='rating',
direction=SortExpression.DESCENDING, default_value=0),
SortExpression(expression='price + tax',
direction=SortExpression.ASCENDING, default_value=999999.99)],
limit=1000)
SortOptions
は、google.appengine.api.search
モジュールで定義されます。
コンストラクタ
SortOptions
クラスのコンストラクタは、次のように定義されます。
- class SortOptions(expressions=None, match_scorer=None, limit=1000)
指定したオプションに従ってドキュメントを並べ替えます。
引数
- expressions
ドキュメントの多次元の並べ替えを表す SortExpression の反復可能オブジェクト。
- match_scorer
マッチ スコアラーの仕様。ドキュメントのスコアの計算で使用されるか、または SortExpression とその他の機能を組み合わせて使用されます。
- limit
スコアを計算するドキュメント数の上限。インデックスが大量に存在する場合はこの制限を設定することをおすすめします。
結果値
SortOptions
クラスの新しいインスタンス。
例外
- TypeError
いずれかのパラメータが無効なタイプであるか、不明な属性が渡されました。
- ValueError
いずれかのパラメータの値が無効です。
プロパティ
SortOptions
クラスのインスタンスには次のプロパティがあります。
- expressions
多次元の並べ替えを指定する SortExpression のリストを返します。
- match_scorer
ドキュメントのスコアの計算に使用するマッチ スコアラーを返します。
- limit
スコアを計算するドキュメント数の上限を返します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-03-06 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-03-06 UTC。"],[[["The `SortOptions` class enables multi-dimensional sorting of documents, leveraging `SortExpression` for detailed control."],["`SortOptions` allows specifying sorting criteria using an iterable of `SortExpression`, a match scorer, and a limit on the number of documents to sort."],["The `SortOptions` constructor can be configured with `expressions`, `match_scorer`, and `limit`, throwing `TypeError` or `ValueError` if input is invalid."],["`SortExpression` objects can define the direction of sorting, such as ascending or descending, and a default value for the sort key."],["`SortOptions` properties `expressions`, `match_scorer`, and `limit` allow you to access the configured settings for sorting."]]],[]]