[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Boost results\n\nVertex AI Search for commerce offers a feature that lets you specify records that should be elevated in searches. You can control the result ranking by applying a boosting rule to\nprioritize or deprioritize returned search items.\n\nBoosting rules\n--------------\n\nBoosting rules can only be applied when there's a base relevance score, such as in relevance-ordered searches or browse results with pre-sort scores. Boosting is a multiplier function applied to these search and browse results.\n| **Note:** Filtering rules always take precedence over boost rules. For more information about filtering and ordering search results, see [Filter and order results](/retail/docs/filter-and-order).\n\n### Boost or bury\n\nOne product can be conditioned by multiple boost or bury rules, which are set in the\n`boostspec` class of the search service API.\n\n- A positive number indicates a boost rule, a promotion.\n- A negative number indicates a bury rule, which is a demotion instead of promotion.\n\n### Configuration options\n\n- **Sum of boost effect**: If there's a demotion plus a promotion, Vertex AI Search for commerce adds up these values. The resulting sum is either a lowered boost or net bury effect.\n- **Max boost rule (default**): Vertex AI Search for commerce checks whichever is the maximum value and ignores the other rules.\n\n### Multiple boost or bury rules set to one product\n\nMultiple boost or bury rules can affect a product, with either a sum or max of the boost values determining the final score.\n\nWhen several boosting rules are applied to the same product, always check if another product's score has ousted the product from the top spot. Max mode is set to default so that this problem is less likely to occur.\n\nAssume one product gets boosts of 2, 3, and 0.5, and another product gets one boost of 0.5. Although the product only received a 0.5 boost score, when it's boosted repeatedly, it outranks the other product. Carefully check the boosting spec to make sure it's not overlapping, or it's overlapping as intended.\n\n### Overriding filters\n\nTwo types of filters that take precedence on top of boosting rules:\n\n1. **User-specified**: These can be things like price or brand, and appear to the end user as tiles or facets on the website.\n\n2. **Topicality (relevance)** : These filters only exist for search queries (not browsing). They exclude less relevant products from the search results. For example, the search *refrigerator* doesn't return microwaves or accessories, such as refrigerator handles. The filter recognizes not to boost a microwave for a refrigerator search.\n\n#### Filters available in search and browse\n\n- **Search**: Topicality filter plus any other user-applied filters such as on-site facets.\n- **Browse**: Since there is no text-query, only the user-applied filters are applied. Filters are also applied to check that the product (let's say, suits) belongs to the correct product category (not sweaters, for example).\n\nDebugging and troubleshooting\n-----------------------------\n\nEvery product is eligible for unlimited boosting, but user-applied filters eliminate products from the search response. To troubleshoot why a boosted product might not appear in search and browse results, check for:\n\n- **Multiple boost rules (including bury demotions)**: Check boost mode configuration (sum or max) and determine the final score.\n- **Relevance** : A product must be relevant for the query and pass the relevance filters. If a search query is for Nike shoes and the product title is *Air Jordans,* the words don't match, but their close semantic relationship results in a high relevance score. A product title such as *yellow jacket* has a low relevance score with a Nike search query. Similarly, if the product title is a cryptic model number that has no relationship to any word whatsoever, the relevance score will be low for any query.\n- **Filters**: Filtering rules override any boost rule, and prevent boosted products from appearing in results. The filter is always applied atop the boost. If a product has user-applied filters, or if a product category filters for browsing, the boost won't work at all.\n\nBoosting tutorial\n-----------------\n\nThis tutorial shows you some examples of product boosting.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nCloud Shell Editor, click **Guide me**:\n\n[Guide me](https://shell.cloud.google.com/?walkthrough_tutorial_id=retail--retail_api_v2_boosting_select_language&show=ide&environment_deployment=ide)\n\n*** ** * ** ***\n\nConfigure boost\n---------------\n\nThis page uses the following dataset as an example. Only the fields necessary\nfor explanation are included.\n\n### Example dataset\n\n#### Example product dataset\n\n### Example search request and response\n\nFor example, if you search for \"Google speaker\", then you would get\n\"nest_mini_2nd_gen\", \"nest_audio\", \"nest_hub_max\", \"nest_hub\", \"google_home_max\"\nand \"google_home_mini\" in no specific order.\n\n#### Example search request and response\n\n### Java\n\n import com.google.cloud.retail.v2.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.html;\n import com.google.cloud.retail.v2.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.html.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.html;\n import com.google.cloud.retail.v2.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.html.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.html.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.html;\n import com.google.cloud.retail.v2.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchResponse.html;\n import com.google.cloud.retail.v2.https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchServiceClient.html;\n\n public static void searchProductsWithBoostSpec(String query, int pageSize,\n String condition, float boostStrength) throws IOException, InterruptedException {\n https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.html boostSpec = https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.html.newBuilder()\n .https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.Builder.html#com_google_cloud_retail_v2_SearchRequest_BoostSpec_Builder_addConditionBoostSpecs_com_google_cloud_retail_v2_SearchRequest_BoostSpec_ConditionBoostSpec_(https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec.html.newBuilder()\n .setCondition(condition)\n .setBoost(boostStrength)\n .build())\n .build();\n\n https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.html searchRequest = https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.html.newBuilder()\n .setPlacement(DEFAULT_SEARCH_PLACEMENT_NAME)\n .setBranch(DEFAULT_BRANCH_NAME)\n .setVisitorId(VISITOR_ID)\n .setQuery(query)\n .setPageSize(pageSize)\n .https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchRequest.Builder.html#com_google_cloud_retail_v2_SearchRequest_Builder_setBoostSpec_com_google_cloud_retail_v2_SearchRequest_BoostSpec_(boostSpec)\n .build();\n\n try (https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchServiceClient.html searchClient = https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchServiceClient.html.create()) {\n https://cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2.SearchResponse.html response = searchClient.search(searchRequest).getPage().getResponse();\n System.out.println(\"Search response: \" + searchResponse);\n }\n }\n\n### Example boost spec\n\nSuppose that you want to prioritize the cheaper products (less than 95\ndollars) and deprioritize the expensive ones (higher than 95 dollars). You can\napply a boost spec as: \n\n### JSON\n\n```bash\n{\n condition_boost_specs {\n condition: \"price: IN(*, 95.0e)\"\n boost: 0.5\n }\n condition_boost_specs {\n condition: \"price: IN(95.0e, *)\"\n boost: -0.5\n }\n}\n```\n\nIn the result, `\"nest_mini_2nd_gen\"`, `\"google_home_mini\"` and `\"nest_hub\"` might be the\nfirst three, while `\"nest_audio\"`, `\"nest_hub_max\"` and `\"google_home_max\"` might be\nlast three. However, no specific order is predetermined, in contrast to\nordering by price, as discussed in [Filter and order results](/retail/docs/filter-and-order)."]]