{"id":1005,"date":"2020-06-04T15:06:00","date_gmt":"2020-06-04T13:06:00","guid":{"rendered":"https:\/\/rc.mmmake.com\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/"},"modified":"2023-08-14T18:16:09","modified_gmt":"2023-08-14T16:16:09","slug":"sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2","status":"publish","type":"post","link":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/","title":{"rendered":"Sitecore SXA &#8211; Custom Search Query Token to filter a shared Search Scope by the Context Home Item"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I know, that sounds really complex. But the solution is surprisingly simple, so keep on reading!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And let&#8217;s do this the proper way: Why would I (or you) need a <em>Custom Search Query Token to filter a shared Search Scope by the Context Home Item<\/em>?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lately I had some requirements, where I get in conflict with the search criteria settings of the sites within a tenant.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One task was to create a fulltext search for every <strong>SINGLE<\/strong> site within the tenant.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I thought that this should be an easy task in SXA:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a shared search scope<\/li>\n\n\n\n<li>Set the templates which should be searched for in the Query Builder<\/li>\n\n\n\n<li>Set the <strong>&#8220;Associated Content&#8221;<\/strong> field for each site in the settings item to the current site <em>(or leave the field empty)<\/em><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>It worked within minutes!<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another task was to grab all news items on a news overview page from <strong>ALL<\/strong> sites within the tenant. There was a seperate search scope to query these news items as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What to do now? Changing the <strong>&#8220;Associated Content&#8221;<\/strong> field to the <strong>&#8220;tenant&#8221;<\/strong> item works fine. I got all the news items from all sites, but my fulltext search also displayed pages from other sites \u2013 which it was not supposed to.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few options to fix this, but first I set up the <strong>&#8220;Associated Content&#8221;<\/strong> field to the <strong>&#8220;tenant&#8221;<\/strong> item. And that&#8217;s really where this topic begins, because no out-of-the-box solution fits my needs <em>(please feel free to correct me if I&#8217;m wrong!)<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"threeroadsleadtorome\">Three roads lead to Rome<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I had to make a decision here on how to proceed. I considered 3 options:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a search scope for every single site within the tenant &#8230; <strong>Doh!<\/strong> That could be lot of work if there are a lot of sites.<\/li>\n\n\n\n<li>Take a closer look on how the <strong>&#8220;resolveSearchQueryTokens&#8221;<\/strong> pipeline works. The SXA query tokens are also part of this pipeline.<\/li>\n\n\n\n<li>Ask around in the SXA Slack Channel for a better solution.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">More options are really appreciated \u2013 if there are any \u2013 because we are in a multisite environment and the search scopes live within a shared site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After a bit more research and careful investigating, I decided to go with the custom search query token.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Oh, I promised you an easy solution, but already wrote so much. Sometimes I just want to share the background or the challenge of a task as well! Bear with me, we&#8217;ll get to the juicy part now!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"howtocreateacustomsearchquerytokenwithsitecoresxa\">How to create a Custom Search Query Token with Sitecore SXA<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1createanewvisualstudioproject\">1. Create a new Visual Studio Project<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Call it for example <strong>&#8220;My.Foundation.Search&#8221;<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2copythecurrentlocationprocessor\">2. Copy the &#8220;CurrentLocation&#8221;-Processor<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The processor is located in the <strong>&#8220;Sitecore.XA.Foundation.Search.Pipelines.ResolveSearchQueryTokens&#8221;<\/strong>-Namespace, it looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using Sitecore.ContentSearch.Utilities;\nusing Sitecore.XA.Foundation.Search.Attributes;\n\nnamespace Sitecore.XA.Foundation.Search.Pipelines.ResolveSearchQueryTokens\n{\n    public class CurrentLocation : ResolveBasicSearchQueryTokens\n    {\n        &#91;SxaTokenKey]\n        protected override string TokenKey\n        {\n            get\n            {\n                return \"UnderCurrentPage\";\n            }\n        }\n\n        protected override void ProcessModel(\n            SearchStringModel model,\n            ResolveSearchQueryTokensEventArgs args)\n        {\n            model.Type = \"location\";\n            model.Value = args.ContextItem.ID.ToString();\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It was not easy to find the right processor, because the token is called <strong>&#8220;UnderCurrentPage&#8221;<\/strong>, but the class is called <strong>&#8220;CurrentLocation&#8221;<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But as you can see this is very similar to my requirement. There is a context item, but I need the <strong>&#8220;Home Item&#8221;<\/strong> of this context item, so I have to do some adjustments.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"3createaclasswithinyourproject\">3. Create a class within your project<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Paste the code of the original processor and name it <strong>&#8220;CurrentHomeItem&#8221;<\/strong>, adjust your namespace for example <strong>&#8220;My.Foundation.Search.Pipelines.ResolveSearchQueryTokens&#8221;<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"4changethetokenkey\">4. Change the TokenKey<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, change the TokenKey value. In my case I took <strong>&#8220;UnderCurrentHomeItem&#8221;<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"5dothemagic\">5. Do the &#8220;magic&#8221;<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">So what kind of magic should happen now? <strong>DotPeek magic for sure!<\/strong><br>Also difficult to find if you are not used to working in a multisite environment. If you did, you must have already seen the <strong>&#8220;IMultisiteContext&#8221;<\/strong> interface, it&#8217;s a true gem!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Inject the interface into your class:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private readonly IMultisiteContext _multiSiteContext;\n\npublic CurrentHomeItem(IMultisiteContext multiSiteContext)\n{\n    _multiSiteContext = multiSiteContext ?? throw new ArgumentNullException(nameof(multiSiteContext));\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Magic is done! ????????\u200d\u2642\ufe0f<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now set the model value to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>model.Value = _multiSiteContext.GetHomeItem(args.ContextItem).ID.ToString();\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>And that&#8217;s it!<\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"6addyourproccessortothepipeline\">6. Add your proccessor to the pipeline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Create a new config file for example: <em>&#8220;AppConfig\/Include\/Foundation\/My.Foundation.Search.config&#8221;<\/em> and add your class to the <strong>&#8220;resolveSearchQueryTokens&#8221;<\/strong>-pipeline:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;configuration xmlns:patch=\"http:\/\/www.sitecore.net\/xmlconfig\/\"&gt;\n    &lt;sitecore&gt;\n        &lt;pipelines&gt;\n            &lt;resolveSearchQueryTokens&gt;\n                &lt;processor type=\"My.Foundation.Search.Pipelines.ResolveSearchQueryTokens.CurrentHomeItem, My.Foundation.Search\" resolve=\"true\" \/&gt;\n            &lt;\/resolveSearchQueryTokens&gt;\n        &lt;\/pipelines&gt;\n    &lt;\/sitecore&gt;\n&lt;\/configuration&gt;\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"7setthetokenwithinyourquerylikethis\">7. Set the token within your query, like this:<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/QueryBuilder.jpg?la=de-de\" alt=\"QueryBuilder\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"8setthesearchscopeinyoursearchresultsandorsearchbox\">8. Set the search scope in your search results and \/ or searchbox<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/SearchResultScope.jpg\" alt=\"Search Result Scope\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Your search results are now displayed based on the <strong>&#8220;Context Home Item&#8221;<\/strong>, even if the <strong>&#8220;Associated Content&#8221;<\/strong> field points to the <strong>&#8220;tenant&#8221;<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Just keep in mind that on a shared site your query builder will no longer display any results! But on the other sites the query will return exactly the result you expected. ????<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy Tokening<br>Dirk<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"theauthor\">The author<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><img loading=\"lazy\" decoding=\"async\" style=\"height: 100px; width: 100px;\" src=\"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/dirk-autor.png?h=100&amp;w=100\" alt=\"Dirk Sch\u00e4fauer\" width=\"100\" height=\"100\"><br><em><strong>Dirk Sch\u00e4fauer<\/strong><\/em><br><a href=\"https:\/\/de.linkedin.com\/in\/dirk-sch%C3%A4fauer-115a35b1\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/linkedin-logo-75x30-1.jpg\" alt=\"Dirk Sch\u00e4fauer\" width=\"75\" height=\"30\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know, that sounds really complex. But the solution is surprisingly simple, so keep on reading! And let&#8217;s do this&#8230;<\/p>\n","protected":false},"author":2,"featured_media":293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com\" \/>\n<meta property=\"og:description\" content=\"I know, that sounds really complex. But the solution is surprisingly simple, so keep on reading! And let&#8217;s do this...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/\" \/>\n<meta property=\"og:site_name\" content=\"mmmake.com\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-04T13:06:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-14T16:16:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"1349\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"camaoadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"camaoadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/\"},\"author\":{\"name\":\"camaoadmin\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#\\\/schema\\\/person\\\/6bac431d80403c17f102fd00b632d8a6\"},\"headline\":\"Sitecore SXA &#8211; Custom Search Query Token to filter a shared Search Scope by the Context Home Item\",\"datePublished\":\"2020-06-04T13:06:00+00:00\",\"dateModified\":\"2023-08-14T16:16:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/\"},\"wordCount\":743,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Wal-Sitecore-Search-Token.jpg\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/\",\"url\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/\",\"name\":\"Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Wal-Sitecore-Search-Token.jpg\",\"datePublished\":\"2020-06-04T13:06:00+00:00\",\"dateModified\":\"2023-08-14T16:16:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Wal-Sitecore-Search-Token.jpg\",\"contentUrl\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Wal-Sitecore-Search-Token.jpg\",\"width\":1800,\"height\":1349},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/blog\\\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mmmake.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sitecore SXA &#8211; Custom Search Query Token to filter a shared Search Scope by the Context Home Item\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/mmmake.com\\\/en\\\/\",\"name\":\"mmmake.com\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/mmmake.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#organization\",\"name\":\"mmmake.com\",\"url\":\"https:\\\/\\\/mmmake.com\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/mmmake-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/mmmake.com\\\/wp-content\\\/uploads\\\/2023\\\/08\\\/mmmake-logo.jpg\",\"width\":538,\"height\":290,\"caption\":\"mmmake.com\"},\"image\":{\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mmmake.com\\\/en\\\/#\\\/schema\\\/person\\\/6bac431d80403c17f102fd00b632d8a6\",\"name\":\"camaoadmin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/","og_locale":"en_US","og_type":"article","og_title":"Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com","og_description":"I know, that sounds really complex. But the solution is surprisingly simple, so keep on reading! And let&#8217;s do this...","og_url":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/","og_site_name":"mmmake.com","article_published_time":"2020-06-04T13:06:00+00:00","article_modified_time":"2023-08-14T16:16:09+00:00","og_image":[{"width":1800,"height":1349,"url":"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg","type":"image\/jpeg"}],"author":"camaoadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"camaoadmin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#article","isPartOf":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/"},"author":{"name":"camaoadmin","@id":"https:\/\/mmmake.com\/en\/#\/schema\/person\/6bac431d80403c17f102fd00b632d8a6"},"headline":"Sitecore SXA &#8211; Custom Search Query Token to filter a shared Search Scope by the Context Home Item","datePublished":"2020-06-04T13:06:00+00:00","dateModified":"2023-08-14T16:16:09+00:00","mainEntityOfPage":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/"},"wordCount":743,"commentCount":0,"publisher":{"@id":"https:\/\/mmmake.com\/en\/#organization"},"image":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#primaryimage"},"thumbnailUrl":"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/","url":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/","name":"Sitecore SXA - Custom Search Query Token to filter a shared Search Scope by the Context Home Item - mmmake.com","isPartOf":{"@id":"https:\/\/mmmake.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#primaryimage"},"image":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#primaryimage"},"thumbnailUrl":"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg","datePublished":"2020-06-04T13:06:00+00:00","dateModified":"2023-08-14T16:16:09+00:00","breadcrumb":{"@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#primaryimage","url":"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg","contentUrl":"https:\/\/mmmake.com\/wp-content\/uploads\/2020\/06\/Wal-Sitecore-Search-Token.jpg","width":1800,"height":1349},{"@type":"BreadcrumbList","@id":"https:\/\/mmmake.com\/en\/blog\/sitecore-sxa-custom-search-query-token-to-filter-a-shared-search-scope-by-the-context-home-item-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mmmake.com\/en\/"},{"@type":"ListItem","position":2,"name":"Sitecore SXA &#8211; Custom Search Query Token to filter a shared Search Scope by the Context Home Item"}]},{"@type":"WebSite","@id":"https:\/\/mmmake.com\/en\/#website","url":"https:\/\/mmmake.com\/en\/","name":"mmmake.com","description":"","publisher":{"@id":"https:\/\/mmmake.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mmmake.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mmmake.com\/en\/#organization","name":"mmmake.com","url":"https:\/\/mmmake.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mmmake.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/mmmake.com\/wp-content\/uploads\/2023\/08\/mmmake-logo.jpg","contentUrl":"https:\/\/mmmake.com\/wp-content\/uploads\/2023\/08\/mmmake-logo.jpg","width":538,"height":290,"caption":"mmmake.com"},"image":{"@id":"https:\/\/mmmake.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/mmmake.com\/en\/#\/schema\/person\/6bac431d80403c17f102fd00b632d8a6","name":"camaoadmin"}]}},"_links":{"self":[{"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/posts\/1005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/comments?post=1005"}],"version-history":[{"count":2,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"predecessor-version":[{"id":12481,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/posts\/1005\/revisions\/12481"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/media\/293"}],"wp:attachment":[{"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mmmake.com\/en\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}