ルールの追加
このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。
widget.items.search.ruleオブジェクトを使って、Sitecore Searchが特定の結果アイテムをどのように扱うかを設定できます。アイテムやカテゴリはブラックリスト、ブースト、埋め込み、含め、ピン留めが可能です。pinルールを除き、ルールが適用されるアイテムを指定するには、ruleオブジェクト内にfilterオブジェクトをネストする必要があります。
このオブジェクトのデータモデルについては、Search and Recommendation APIリファレンスを参照してください。
!注APIリクエストで通したルールは、Sitecore Searchで設定されたルールを上書きします。
アイテムをスロットにブーストする
アイテムやカテゴリをスロットにブーストするには、widget.items.search.rule.boostオブジェクトを追加してください。ブーストしたい商品やカテゴリと、それらを表示したいスロットを指定する必要があります。
この例では、
- productカテゴリのすべてのアイテムをブーストしたいです。
- ブーストされたアイテムは検索結果の2番目と3番目のスロットに表示されるようにしたいです。
以下のコードはサンプルリクエストを示しています:
{ "widget": { "items": { "rfk_id": "rfkid_7", "entity": "content", "search": { "content": {}, "rule": { "boost": { "filter": { "type": "eq", "name": "type", "value": "products" }, "slots": 2, 3
}
} } }
}, "context": { "locale": { "country": "us", "language": "en" }, "user": { "uuid": "159871551-1g-i4-4x-1p-f5tdhddqwvywv7b9g2vy-1664852644904" } } }
以下はその要請への回答です:
{ "rfk_id": "rfkid_7", "entity": "content", "content": { "description": "Premier Assure is designed...", "id": "https___www_sitecore_com_activities", "image": "https
/activities/gettyimages-699087272-hero.jpg?md=20220921T172222Z", "image_type": "Image", "image_url": "www.imageur.com", "last_modified": "2022-10-19 `20`", "source_id": "407033", "subtitle": "Improve the quality of your Sitecore investment using a review-based approach.", "title": "Premier Assure services: assuring confidence in your investment", "type": "Knowledge Center", "url": "https://www.sitecore.com/activities" }, { "description": "Sitecore CDP Connector for Responsys...", "id": "https___www_sitecore_com_products_marketplace_tap_cdp_sitecore-cdp-connector-for-responsys", "source_id": "388218", "subtitle": null, "title": "Sitecore CDP Connector for Responsys", "type": "products", "url": "https://www.sitecore.com/products/marketplace/tap/cdp/sitecore-cdp-connector-for-responsys" }, { "description": "Sitecore CDP Integration for Amazon Sagemaker...", "source_id": "388218", "subtitle": null, "title": "Sitecore CDP Integration for Amazon Sagemaker", "type": "products", "url": "https://www.sitecore.com/products/marketplace/tap/cdp/sitecore-cdp-integration-for-amazon-sagemaker" }, { "description": "Related topicsResource hubPersonalizationEnable customer connections with your brand...", "id": "https___www_sitecore_com_content-management", "image": "https/content-gettyimages-691574517-original2.jpg?md=20220107T002955Z", "image_type": "Image", "image_url": "https/588D7FE5D8C&t=544x310", "last_modified": "2022-05-25 `19`", "source_id": "407033", "subtitle": "Content fuels the digital experience in just about every industry.", "title": "Content resources", "type": "Knowledge Center", "url": "https://www.sitecore.com/content-management" } ... , "total_item": 5856, "limit": 10, "offset": 0 } , "dt": 109, "ts": 1669433189900 }レスポンスcontentオブジェクトでは、2番目と3番目の結果項目、すなわちスロット2と3の項目にproduct項目が見られます。
スロットなしでアイテムを強化する
スロットを指定せずにアイテムやカテゴリをブーストするには、widget.items.search.rule.boostオブジェクトを使います。ブーストしたい商品やカテゴリと、ブーストしたい重さを指定する必要があります。
この例では、
- 訪問者はキーワードの 内容を検索します。
- すべてのブログを 5倍の重みでブーストしたいのです。
{ "widget": { "items": { "entity": "content", "rfk_id": "rfkid_7", "search": { "content": {}, "rule": { "boost": { "weight": 4, "filter": { "type": "eq", "name": "type", "value": "Blogs" } }
}, "personalization": { "fields": "title", "type"
}, "limit": 10, "offset": 0, "query": { "keyphrase": "content" } }, "sources": "407033", "408162"
}
}, "context": { "locale": { "country": "us", "language": "en" }, "user": { "uuid": "159871551-ye-l5-4u-1p-0z7apweb0jxcibpfzr40-1663129543566" } } }
ブラックリスト入りの項目
アイテムやカテゴリのリストをブラックリストに載せるには、search.rule.blacklistオブジェクトを追加してください。これらのアイテムやカテゴリは検索結果には一度も表示されません。
この例では、型otherのすべてのコンテンツをブラックリストに入りたいです。以下のコードはサンプルリクエストを示しています:
{ "widget": { "items": { "rfk_id": "rfkid_7", "entity": "content", "search": { "content": {}, "rule": { "blacklist": { "filter": { "type": "eq", "name": "type", "value": "other" } } } } }
}, "context": { "locale": { "country": "us", "language": "en" }, "user": { "uuid": "159871551-1g-i4-4x-1p-f5tdhddqwvywv7b9g2vy-1664852644904" } } }
以下はその要請への回答です:
{ "widgets": { "rfk_id": "rfkid_7", "entity": "content", "content": { "description": "Discover top moments...", "id": "https___www_sitecore_com", "image": "https
.com/sitecore-home-hero-v01-052722_72dpi.jpg?md=20220627T124154Z", "last_modified": "2022-11-18 `16`", "source_id": "407033", "subtitle": "Digital Experience Platform and Content Hub that apply the power of data science and marketing technology to shape your business around new possibilities.", "title": "Turn consumers into fans", "type": "Others", "url": "https://www.sitecore.com" }, { "description": "It captures data...", "id": "https___www_sitecore_com_blog_digital-transformation_7-business-benefits-of-a-customer-data-platform", "image": "https.com/gettyimages-1299625060_insights_feature.png?md=20220224T144643Z", "image_url": "https://imageurl.com/79E042A6C3001AB18B&t=544x310", "last_modified": "2022-04-05 `04`", "product": "Customer Data Platform", "source_id": "407033", "subtitle": "From smashing data silos and building loyalty, to driving revenue, our blog explores 7 transformative business effects of a customer data platform.", "title": "7 business benefits of a customer data platform", "type": "Others", "url": "https://www.sitecore.com/blog/digital-transformation/7-business-benefits-of-a-customer-data-platform" },... , "total_item": 4934, "limit": 10, "offset": 0 } , "dt": 30, "ts": 1669054635432 }
オブジェクトcontent応答では、どの項目もotherのtypeを持っていないことがわかります。
アイテムのピン留め
検索結果の特定のスロットにアイテムをピン留めするには、search.rule.pinオブジェクトを使い、使いたいスロットとピンしたいアイテムのIDを指定します。
この例では、クラウドコンピューティングに関するブログを2番目のスロットにピン留めしたいと思います。
以下のコードはサンプルリクエストを示しています:
{ "widget": { "items": { "rfk_id": "rfkid_7", "entity": "content", "sources": "388218", "390565" , "search": { "content": {}, "rule": { "pin": { "slot": 2, "id": "https___www_sitecore_com_blog_cloud_cloud-computing-in-business-and-the-future-of-cx" }
} } }
}, "context": { "locale": { "country": "us", "language": "en" }, "user": { "uuid": "159871551-1g-i4-4x-1p-f5tdhddqwvywv7b9g2vy-1664852644904" } } }
以下はその要請への回答です:
{ "widgets": { "rfk_id": "rfkid_7", "entity": "content", "content": { "description": "October 13, 2021...", "id": "https___www_sitecore_com_company_news-events_news_2021_10_majority-of-mena-brands-changed-customer-experiences-due-to-the-pandemic", "source_id": "388218", "subtitle": null, "title": "Khaleej Times: Majority of Mena brands changed customer experiences due to the pandemic", "type": "news", "url": "https://www.sitecore.com/company/news-events/news/2021/10/majority-of-mena-brands-changed-customer-experiences-due-to-the-pandemic" }, { "description": "Companies that survived...", "id": "https___www_sitecore_com_blog_cloud_cloud-computing-in-business-and-the-future-of-cx", "image_url": "https://imageurl/cloud-computing-in-business-and-the-future-of-cx/gettyimages-1209700460\_heromedium\_mb.jpg?mw=600&md=20211006T181735Z&hash=827DB91BE20225F7C4BEFDF36BDD0249&t=544x310", "source_id": "388218", "subtitle": "How CIOs can lead organizational transformation starting with marketing.", "title": "Cloud computing in business and the future of CX", "type": "blogs", "url": "https://www.sitecore.com/blog/cloud/cloud-computing-in-business-and-the-future-of-cx" },
... , "total_item": 2881, "limit": 10, "offset": 0 } , "dt": 52, "ts": 1669054542978 }
レスポンスcontentオブジェクトの検索結果の2番目の項目として、必要なブログが2番目の項目として表示されています。