{"id":319,"date":"2013-08-23T13:21:02","date_gmt":"2013-08-23T17:21:02","guid":{"rendered":"http:\/\/www.dontpapanic.com\/blog\/?p=319"},"modified":"2016-04-21T10:53:58","modified_gmt":"2016-04-21T14:53:58","slug":"configuring-search-authoritative-pages-with-powershell","status":"publish","type":"post","link":"https:\/\/www.dontpapanic.com\/blog\/?p=319","title":{"rendered":"Configuring Search Authoritative Pages with PowerShell"},"content":{"rendered":"<p><a href=\"http:\/\/www.dontpapanic.com\/blog\/wp-content\/uploads\/2013\/08\/logo-powershell.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; float: left; padding-top: 0px; padding-left: 0px; margin: 0px 5px 0px 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"logo-powershell\" src=\"http:\/\/www.dontpapanic.com\/blog\/wp-content\/uploads\/2013\/08\/logo-powershell_thumb.png\" alt=\"logo-powershell\" width=\"240\" height=\"162\" align=\"left\" border=\"0\" \/><\/a>Someone at work recently asked if you could configure the Authoritative Pages settings in SharePoint 2013 Search using PowerShell or whether the only way to do it was using the Search Service UI.\u00a0 After a bit of research I found out that indeed you can configure the settings using PowerShell.\u00a0 But I also found out that there isn\u2019t a lot of documentation available on the web about exactly how to do it.\u00a0 The difficulty is made worse by the fact that most of the documentation that does exist is for SharePoint 2010 Enterprise Search and there is a new required parameter in 2013 that makes all those Blog posts invalid.\u00a0 So I decided it would be a good idea to write a \u201cHow To\u201d post that would explain the required PowerShell.<\/p>\n<h2>What are Authoritative Pages?<\/h2>\n<p>When SharePoint web site pages and documents are returned in Search results one of the factors that effects their relevance placement is <em>static rank<\/em>.\u00a0 Static rank is computed as the smallest number of clicks it would take a user to navigate from an <em>authoritative page<\/em> to a document. The closer a document is to the most authoritative page, the higher its static rank is.\u00a0 Search Administrators can enter three (3) levels of authoritative pages for calculating the static rank of a search result.\u00a0 They can also add site addresses to a fourth level which will demote the static rank of a specific result when compared to all other references.\u00a0 In other words the closer a specific document is to one of the three authoritative pages the higher it will appear in a set of search results, while results that come from the non-authoritative sites will be at the bottom of the search results list.\u00a0 For example, you might list a team site that contains draft copies of documents in the Non-authoritative sites and the home page of a document center site contains published copies in the most authoritative pages section.\u00a0 This would lead to the elevation of published copies in search results instead of draft copies.<\/p>\n<h2>The PowerShell Cmdlets<\/h2>\n<p>There are two sets of PowerShell Cmdlets used to manipulate the authoritative pages settings.\u00a0 First, there are four (4) Cmdlets for creating\/managing the three (3) main authoritative page lists.\u00a0 They are:<\/p>\n<ul>\n<li><strong>Get-SPEnterpriseSearchQueryAuthority<\/strong> \u2013 retrieves existing authoritative page(s)<br \/>\n-Identity &lt;AuthorityPagePipeBind&gt;<br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<li><strong>New-SPEnterpriseSearchQueryAuthority<\/strong> \u2013 creates a new authoritative page setting<br \/>\n-Url <em>&lt;String&gt;<\/em><br \/>\n-Level <em>&lt;Single&gt;<\/em><br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<li><strong>Set-SPEnterpriseSearchQueryAuthority<\/strong> \u2013 changes the level of an existing authoritative page<br \/>\n-Identity &lt;AuthorityPagePipeBind&gt;<br \/>\n-Level <em>&lt;Single&gt;<\/em><br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<li><strong>Remove-SPEnterpriseSearchQueryAuthority<\/strong> \u2013 removes an existing authoritative page<br \/>\n-Identity &lt;AuthorityPagePipeBind&gt;<br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<\/ul>\n<p>There are also three (3) Cmdlets for creating\/managing the non-authoritative page list.\u00a0 They are:<\/p>\n<ul>\n<li><strong>Get-SPEnterpriseSearchQueryDemoted <\/strong>\u2013 retrieves existing non-authoritative page(s)<br \/>\n-Identity &lt;AuthorityPagePipeBind&gt;<br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<li><strong>New-SPEnterpriseSearchQueryDemoted <\/strong>\u2013 creates a new non-authoritative page setting<br \/>\n-Url <em>&lt;String&gt;<\/em><br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<li><strong>Remove-SPEnterpriseSearchQueryDemoted <\/strong>\u2013 removes an existing non-authoritative page<br \/>\n-Identity &lt;AuthorityPagePipeBind&gt;<br \/>\n-Owner <em>&lt;SearchObjectOwner&gt;<\/em><br \/>\n-SearchApplication <em>&lt;SearchServiceApplicationPipeBind&gt;<\/em><\/li>\n<\/ul>\n<h2>The Parameters<\/h2>\n<p>As I mentioned before some of the parameters have changed since SharePoint 2010.\u00a0 Most importantly the \u2013<em>Owner<\/em> parameter is now a required parameter and it wasn\u2019t in 2010.\u00a0 Here\u2019s what you need to know about each of the parameters:<\/p>\n<ul>\n<li><strong>Url<\/strong> \u2013 The New commands require a Url to designate the page or site address to be added as an authoritative page entry.<\/li>\n<li><strong>Identity<\/strong> \u2013 Identity is optional for the Get command.\u00a0 Without an Identity the Get command will return all the authoritative pages.\u00a0 The Set and Remove commands require that a specific page be identified.<\/li>\n<li><strong>Level<\/strong> \u2013 Specifies the level where the page address should be added.\u00a0 Valid values are integers 0, 1, and 2 with 0 being the Most Authoritative Pages and 2 being the Third-level Authoritative Pages.<\/li>\n<li><strong>Owner<\/strong> \u2013 This was optional for 2010 but is required in 2013.\u00a0 It must be set to a Search Object Owner designating either a Search Service Application or a Tenant Subscription in a Multi-tenant environment.\u00a0 I\u2019ll provide an example of how to get the Search Object Owner in the sample code below.<\/li>\n<li><strong>SearchApplication<\/strong> \u2013 This is the Search service application object to which the pages will be added.<\/li>\n<\/ul>\n<h2>PowerShell Sample<\/h2>\n<p>Now that we\u2019ve looked at the commands and parameters lets look at a sample script that demonstrates how to use the commands.<\/p>\n<div class=\"csharpcode\">\n<pre class=\"alt\"><span class=\"lnum\">   1:  <\/span><span class=\"rem\">#Get the Enterprise Search Service Application<\/span><\/pre>\n<pre><span class=\"lnum\">   2:  <\/span>$ssa = Get-SPEnterpriseSearchServiceApplication<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">   3:  <\/span><\/pre>\n<pre><span class=\"lnum\">   4:  <\/span><span class=\"rem\">#Get the Search Owner object.  <\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">   5:  <\/span><span class=\"rem\">#Must be either SearchServiceApplication (Ssa) or Multitenancy SiteSubscription (SPSiteSubscription) <\/span><\/pre>\n<pre><span class=\"lnum\">   6:  <\/span>$owner = Get-SPEnterpriseSearchOwner -Level Ssa<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">   7:  <\/span><\/pre>\n<pre><span class=\"lnum\">   8:  <\/span><span class=\"rem\">#Identity is either a valid url or an AuthorityPage Object(Retrieved with Get-SPEnterPriseSearchQueryAuthority)<\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">   9:  <\/span>$url1 = <span class=\"str\">\"http:\/\/siteURL\/\"<\/span><\/pre>\n<pre><span class=\"lnum\">  10:  <\/span>$url2 = <span class=\"str\">\"http:\/\/siteURL\/sites\/sitecollection\/\"<\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  11:  <\/span>$url3 = <span class=\"str\">\"http:\/\/siteURL\/Pages\/Default.aspx\"<\/span><\/pre>\n<pre><span class=\"lnum\">  12:  <\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  13:  <\/span>$mostAuthoritative = 0<\/pre>\n<pre><span class=\"lnum\">  14:  <\/span>$secondMostAuthoritative = 1<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  15:  <\/span>$thirdMostAuthoritative = 2<\/pre>\n<pre><span class=\"lnum\">  16:  <\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  17:  <\/span><span class=\"rem\">#Try to get an existing Authoritative Page <\/span><\/pre>\n<pre><span class=\"lnum\">  18:  <\/span>$sqa = Get-SPEnterpriseSearchQueryAuthority -Identity $url1 -Owner $owner -SearchApplication $ssa -ErrorAction SilentlyContinue<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  19:  <\/span><span class=\"kwrd\">if<\/span> ($sqa <span class=\"preproc\">-eq<\/span> $null)<\/pre>\n<pre><span class=\"lnum\">  20:  <\/span>{<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  21:  <\/span>    <span class=\"rem\">#Create a new Authoritative page if one doesn't exist<\/span><\/pre>\n<pre><span class=\"lnum\">  22:  <\/span>    $sqa = New-SPEnterpriseSearchQueryAuthority -Owner $owner -SearchApplication $ssa -Url $url1 -Level $secondMostAuthoritative<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  23:  <\/span>}<\/pre>\n<pre><span class=\"lnum\">  24:  <\/span><span class=\"kwrd\">else<\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  25:  <\/span>{<\/pre>\n<pre><span class=\"lnum\">  26:  <\/span>    <span class=\"rem\">#Change the level of an exiting Authoritative page<\/span><\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  27:  <\/span>    Set-SPEnterpriseSearchQueryAuthority -Identity $sqa -Level $thirdMostAuthoritative -SearchApplication $ssa -Owner $owner<\/pre>\n<pre><span class=\"lnum\">  28:  <\/span>}<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  29:  <\/span><\/pre>\n<pre><span class=\"lnum\">  30:  <\/span>$sqa2 = Get-SPEnterpriseSearchQueryDemoted -Identity $url3 -Owner $owner -SearchApplication $ssa -ErrorAction SilentlyContinue<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  31:  <\/span><span class=\"kwrd\">if<\/span> ($sqa2 <span class=\"preproc\">-eq<\/span> $null)<\/pre>\n<pre><span class=\"lnum\">  32:  <\/span>{<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  33:  <\/span>    New-SPEnterpriseSearchQueryDemoted -Owner $owner -SearchApplication $ssa -Url $url2<\/pre>\n<pre><span class=\"lnum\">  34:  <\/span>}<\/pre>\n<pre class=\"alt\"><span class=\"lnum\">  35:  <\/span><\/pre>\n<pre><span class=\"lnum\">  36:  <\/span>Remove-SPEnterpriseSearchQueryAuthority -Identity $url3 -Owner $owner -SearchApplication $ssa -Confirm:$false<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Someone at work recently asked if you could configure the Authoritative Pages settings in SharePoint 2013 Search using PowerShell or whether the only way to do it was using the Search Service UI.\u00a0 After a bit of research I found out that indeed you can configure the settings using PowerShell.\u00a0 But I also found out &hellip; <a href=\"https:\/\/www.dontpapanic.com\/blog\/?p=319\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Configuring Search Authoritative Pages with PowerShell<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59,84],"tags":[66,60,23],"class_list":["post-319","post","type-post","status-publish","format-standard","hentry","category-sharepoint-2013","category-tips","tag-search-service","tag-sharepoint_2013","tag-tips"],"_links":{"self":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319"}],"version-history":[{"count":3,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":420,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/319\/revisions\/420"}],"wp:attachment":[{"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dontpapanic.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}