Python 2.7 telah mencapai akhir dukungan
dan akan
dihentikan penggunaannya
pada 31 Januari 2026. Setelah penghentian penggunaan, Anda tidak akan dapat men-deploy aplikasi Python 2.7, meskipun organisasi Anda sebelumnya menggunakan kebijakan organisasi untuk mengaktifkan kembali deployment runtime lama. Aplikasi Python 2.7 yang ada akan terus berjalan dan menerima traffic setelah
tanggal penghentiannya. Sebaiknya Anda
bermigrasi ke versi Python terbaru yang didukung.
Class FieldExpression
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Class FieldExpression
memungkinkan Anda menghitung cuplikan konten yang disesuaikan untuk setiap hasil yang ditampilkan oleh penelusuran.
FieldExpression
ditentukan dalam modul google.appengine.api.search
.
Konstruktor
Konstruktor untuk class FieldExpression
ditentukan sebagai berikut:
-
class FieldExpression(name, expression)
Buat instance class FieldExpression
.
Misalnya,
FieldExpression(name='content_snippet',
expression='snippet("very important", content)')
membuat ekspresi kolom yang menampilkan kolom komputasi bernama content-snippet
dengan setiap hasil penelusuran, yang berisi cuplikan HTML kolom content
yang cocok dengan kueri "very
important"
.
Argumen
- name
Nama kolom yang dihitung.
- expression
Ekspresi yang akan dievaluasi dan ditampilkan.
Nilai hasil
Instance baru dari class FieldExpression
.
Pengecualian
- TypeError
Parameter memiliki jenis yang tidak valid, atau atribut yang tidak diketahui telah diteruskan.
- ValueError
Parameter memiliki nilai yang tidak valid.
Properti
Instance class FieldExpression
memiliki properti berikut:
- name
Nama kolom yang dihitung.
- expression
String yang berisi ekspresi yang akan dievaluasi dan ditampilkan.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-09-04 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eFieldExpression\u003c/code\u003e enables the computation of custom content snippets for each search result.\u003c/p\u003e\n"],["\u003cp\u003eThis API is available for first-generation runtimes and is applicable when upgrading to second-generation runtimes.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFieldExpression\u003c/code\u003e constructor takes a \u003ccode\u003ename\u003c/code\u003e for the computed field and an \u003ccode\u003eexpression\u003c/code\u003e to define how the content is generated.\u003c/p\u003e\n"],["\u003cp\u003eThe properties \u003ccode\u003ename\u003c/code\u003e and \u003ccode\u003eexpression\u003c/code\u003e hold the name of the computed field and the string defining its expression, respectively.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFieldExpression\u003c/code\u003e will raise a TypeError or ValueError exception if invalid types or values are passed during instantiation.\u003c/p\u003e\n"]]],[],null,["# The FieldExpression Class\n\nClass `FieldExpression` allows you to compute customized content snippets for each result returned by a search.\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`FieldExpression` is defined in the module `google.appengine.api.search`.\n\nConstructor\n-----------\n\nThe constructor for class `FieldExpression` is defined as follows:\n\n\nclass FieldExpression(name, expression)\n\n:\n\n Construct an instance of class `FieldExpression`.\n\n For example, \n\n ```python\n FieldExpression(name='content_snippet',\n expression='snippet(\"very important\", content)')\n ```\n\n constructs a field expression that returns a computed field named `content-snippet` with each search result, containing HTML snippets of the `content` field that match the query `\"very` `important\"`.\n\n \u003cbr /\u003e\n\n:\n\n Arguments\n\n name\n\n : Name of computed field.\n\n expression\n\n : Expression to evaluate and return.\n\n Result value\n\n : A new instance of class `FieldExpression`.\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 `FieldExpression` has the following properties:\n\nname\n\n: Name of computed field.\n\nexpression\n\n: String containing expression to evaluate and return."]]