[[["容易理解","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 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eRescoringMatchScorer\u003c/code\u003e sorts documents by query match quality using a complex algorithm that considers term frequency and field type.\u003c/p\u003e\n"],["\u003cp\u003eThe scoring algorithm used by \u003ccode\u003eRescoringMatchScorer\u003c/code\u003e is subject to change, potentially impacting the order of search results.\u003c/p\u003e\n"],["\u003cp\u003eDocuments are sorted in descending order by default using \u003ccode\u003eRescoringMatchScorer\u003c/code\u003e, resulting in positive scores.\u003c/p\u003e\n"],["\u003cp\u003eTo sort in ascending order, use \u003ccode\u003eSortExpression\u003c/code\u003e with the \u003ccode\u003e_score\u003c/code\u003e expression and \u003ccode\u003eASCENDING\u003c/code\u003e direction, which results in negative scores.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRescoringMatchScorer\u003c/code\u003e is available in first-generation runtimes and can be used when upgrading to corresponding second-generation runtimes.\u003c/p\u003e\n"]]],[],null,["# class RescoringMatchScorer\n\nClass `RescoringMatchScorer` allows you to sort documents based on the quality\nof query match. It is similar to a\n[MatchScorer](/appengine/docs/legacy/standard/python/search/matchscorerclass)\nbut uses a more complex scoring algorithm based on match term frequency and other factors like field type.\nPlease be aware that this algorithm is continually refined and can change over time without notice. This means that the ordering\nof search results that use this scorer can also change without notice.\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\nTo use a `RescoringMatchScorer`, add it to the `SortOptions` as in the following code:\n\n\n```python\n sort_opts = search.SortOptions(match_scorer=search.RescoringMatchScorer())\n```\n\nThis sorts the documents in descending score order. The scores will be\npositive.\n\nIf you want to sort in ascending order, then use the following code: \n\n```python\n sort_opts = search.SortOptions(match_scorer=search.RescoringMatchScorer(),\n expressions=[search.SortExpression(\n expression='_score', direction=search.SortExpression.ASCENDING,\n default_value=0.0)])\n```\n\nThe scores in this case will be negative.\n\n`RescoringMatchScorer` is defined in the `google.appengine.api.search` module.\n\nConstructor\n-----------\n\nThe constructor for class `RescoringMatchScorer` is defined as follows:\n\nclass RescoringMatchScorer()\n\n: Assigns a document score to search results representing how well they match the query, base on frequency of terms in the document and weighted by doc parts.\n\n Result value\n\n : A new instance of class `RescoringMatchScorer`.\n\n Exceptions\n\n TypeError\n\n : If any of the parameters have an invalid type, or an unknown attribute is passed.\n\n ValueError\n\n : If any parameter has an invalid value.\n\n \u003cbr /\u003e"]]