Python 2.7 ha raggiunto la fine del supporto
e verrà
ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni Python 2.7, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni Python 2.7 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di
eseguire la migrazione all'ultima versione supportata di Python.
La classe FacetRefinement
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
La classe FacetRefinement
viene utilizzata per restringere i risultati di ricerca in base a un valore del facet.
Il modo consigliato per utilizzare il perfezionamento dei parametri è utilizzare la stringa del token. Ogni FacetResult avrà un token accettabile anziché questo tipo. Per fornire una definizione manuale di FacetRefinement, un'istanza di questa classe può essere passata a SearchOptions.
FacetRefinement
è definito nel modulo google.appengine.api.search
.
Costruttore
Il costruttore della classe FacetRefinement
è definito come segue:
class FacetRefinement(name, value=None, facet_range=None)
Costruisci un'istanza della classe FacetRefinement
.
NOTA: deve essere impostato il valore o l'intervallo di facet, ma non entrambi.
Argomenti
- name
Imposta la proprietà name
- value
Imposta la proprietà value
- facet_range
Imposta la proprietà facet_range
Valore del risultato
Una nuova istanza della classe FacetRefinement
.
Eccezioni
- TypeError
Se uno dei parametri ha tipi non validi o viene passato un attributo sconosciuto.
- ValueError
Se uno dei parametri ha valori non validi.
Proprietà
Un'istanza della classe FacetRefinement
ha le seguenti proprietà:
- name
nome del perfezionamento della frazione.
- value
valore stringa della raffinatezza del livello.
- intervallo
Intervallo numerico del perfezionamento del facet.
Metodi istanza
Le istanze della classe FacetRefinement
hanno i seguenti metodi:
- ToTokenString()
Consente di convertire questo perfezionamento in una stringa di token sicura da utilizzare in HTML. Il formato di questa stringa potrebbe cambiare.
-
Valore del risultato
Una stringa di token sicura da utilizzare in HTML per questo perfezionamento della frazione.
- FromTokenString()
Questo metodo statico converte una stringa di token in un oggetto FacetRefinement. Non memorizzare stringhe di token tra versioni diverse dell'API perché la chiave potrebbe essere incompatibile.
-
Argomenti
- token_string
Una stringa di token creata dal metodo ToTokenString o restituita
da un risultato di ricerca.
Valore del risultato
Un oggetto FacetRefinement.
Eccezioni
- ValueError
Se la stringa token non è valida.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-09-04 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eFacetRefinement\u003c/code\u003e class is used to refine search results based on a specific facet value.\u003c/p\u003e\n"],["\u003cp\u003eWhile manual \u003ccode\u003eFacetRefinement\u003c/code\u003e is possible, using the token string from \u003ccode\u003eFacetResult\u003c/code\u003e is the recommended approach.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFacetRefinement\u003c/code\u003e constructor accepts a name, a value, or a \u003ccode\u003efacet_range\u003c/code\u003e, but only one of the value or facet_range can be specified.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacetRefinement\u003c/code\u003e instances have \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003evalue\u003c/code\u003e, and \u003ccode\u003erange\u003c/code\u003e properties that define the refinement.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFacetRefinement\u003c/code\u003e objects can be converted to token strings using \u003ccode\u003eToTokenString()\u003c/code\u003e and can be created from a token string using the \u003ccode\u003eFromTokenString()\u003c/code\u003e method.\u003c/p\u003e\n"]]],[],null,["# The FacetRefinement Class\n\nClass `FacetRefinement` is used to narrow search results based on a facet value.\n\nThe recommended way to use facet refinement is to use its token string. Each FacetResult will\nhave a token that is acceptable instead of this class. To provide manual FacetRefinement, an\ninstance of this class can be passed to SearchOptions.\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`FacetRefinement` is defined in the module `google.appengine.api.search`.\n\nConstructor\n-----------\n\nThe constructor for class `FacetRefinement` is defined as follows:\n\nclass FacetRefinement(name, value=None, facet_range=None)\n\n: Construct an instance of class `FacetRefinement`.\n\n NOTE: Either the value or the facet_range should be set but not both.\n\n:\n\n Arguments\n\n name\n\n : Sets the name property\n\n value\n\n : Sets the value property\n\n facet_range\n\n : Sets the facet_range property\n\n Result value\n\n : A new instance of class `FacetRefinement`.\n\n Exceptions\n\n TypeError\n\n : If any of the parameters have invalid types, or an unknown\n attribute is passed.\n\n ValueError\n\n : If any of the parameters have invalid values.\n\n \u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProperties\n----------\n\nAn instance of class `FacetRefinement` has the following properties:\n\nname\n\n: name of the facet refinement.\n\nvalue\n\n: string value of the facet refinement.\n\nrange\n\n: numeric range of the facet refinement.\n\nInstance Methods\n----------------\n\nInstances of class `FacetRefinement` have the following methods:\n\nToTokenString()\n\n: Converts this refinement to a token string safe to be used in HTML. The format of this string may change.\n\n: Result value\n\n : A token string safe to be used in HTML for this facet refinement.\n\nFromTokenString()\n\n: This static method converts a token string to a FacetRefinement object. Do not store token strings between different versions of API as key could\n be incompatible.\n\n: Arguments\n\n token_string\n\n : A token string created by ToTokenString method or returned\n by a search result.\n\n Result value\n\n : A FacetRefinement object.\n\n Exceptions\n\n ValueError\n\n : If the token_string is invalid."]]