Showing posts with label SharePoint 2013 Search. Show all posts
Showing posts with label SharePoint 2013 Search. Show all posts

Wednesday, December 10, 2014

SharePoint 2013 Search: Error Launching Query Builder - RESOLVED

Problem
When attempting to launch the query builder when creating a new Content Source or Result Source via Central Admin you receive an error as follows:

Error: Not able to connect to search service to retrieve valid settings.


Solution
You need administrator rights to the Search Service Application - even if you are a farm administrator. (I just recently encountered this issue but thought it worked before - I am thinking that recent patches and updates plugged a security hole).

Solution Implementation - PowerShell
You can solve this easily by running the following PowerShell script with your account name:

$principal = New-SPClaimsPrincipal "DOMAIN\USERNAME" -IdentityType WindowsSamAccountName

$spapp = Get-SPEnterpriseSearchServiceApplication

$security = Get-SPServiceApplicationSecurity $spapp –Admin

Grant-SPObjectSecurity $security $principal "Full Control"

Set-SPServiceApplicationSecurity $spapp $security –Admin 

Solution Implementation - Central Admin
You may also solve this via Central Admin.

From Application Management, click on the Manage service applications link under the Service Applications section:


Scroll down to your Search Service Application and select it:


On the SERVICE APPLICATIONS top ribbon, click the Administrators button:


In the Administrators dialog, enter the account that needs permissions and click the Add button:

Select the account in the list and grant Full Control:


Click OK.

The Query Builder dialog will now launch properly without any trouble.






Thursday, November 21, 2013

SharePoint 2013 Search: BCS Crawl Error - Server Too Busy Exception

I recently was attempting to crawl external data using BCS. I started to receive errors in the crawl log:


Error while crawling LOB contents. ( Error caused by exception: System.ServiceModel.ServerTooBusyException An error occurred. Administrators, see the server log for more information. )

Server too busy? I knew my servers weren't pegged. Tracing the errors in the ULS logs, I found the following:

The BDC Service application Business Data Connectivity Service is not accessible. The full exception text is: The HTTP service located at http://SSRSServer:32843/c2f2c958afc44ef0a9058500c319a619/BdcService.svc/http is unavailable.

What had happened was I was actually moving the BCS Service around to different servers. I had it running on my search servers but wanted to see if I could relieve resource usage if I moved BCS to a different tier. I moved them to our SSRS servers, did some testing, but then decided to move the BCS Services back to the search servers.

The error in the ULS logs showed me that the crawl was still trying to access BCS on the SSRS Servers. A quick reboot of my search servers (running all search components except query and index so search doesn't go down) and the crawl of the BCS content continued working as normal!



 

Monday, October 28, 2013

SharePoint 2013: Cleaning Up Inactive Search Topologies

I woke up Saturday morning with a text message from a SharePoint friend:

"Hey, if u have 2 search topologies, one active and one inactive, can you delete the inactive one?"

I was thinking that this was only in memory since you create clones of the current search topology and then activate it after making appropriate changes. Nope. Every time you update the search topology, the previous one becomes inactive and sticks around in the search database.

You can view your inactive topologies using the following PowerShell command line:

Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchTopology |? {$_.State -eq "Inactive"}

 

With all of my scale-out activities, I had 33 inactive search topologies - doh!

Expanding upon the previous PowerShell command line, you can easily remove all of these:

Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchTopology |? {$_.State -eq "Inactive"} |% { Remove-SPEnterpriseSearchTopology -Identity $_ -Confirm:$false};



You may run the first command line again to verify there are no more inactive search topologies.


Thanks to Chris Rumel for posting this quick PowerShell code here.


 

Saturday, August 31, 2013

SharePoint 2013: How To Integrate BCS with Search


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

Introduction

This post discusses the overall process of incorporating external data into SharePoint 2013 Search by leveraging Business Data Connectivity Services (BCS). I have an end-to-end solution that integrates product data from a SQL Server database into SharePoint 2013 by using external content types. This is covered in my Search Walkthrough Guide as well as my Enhancing the Search Experience Guide. However, the detailed steps are also available on their own within my SharePoint 2013 Solution Series guides. (Sorting and refinement only appear in the larger).


Step 1: Prepare the Data Source

The first step is to create your read list and read item procedures.
  • Create a stored procedure that returns all of the information you want to search and make sure all rows are returned. 
  • Create a stored procedure that returns the same information but only for a particular entity by using the ID as a parameter.

Step 2: Add Credentials to the Secure Store Service

In order for the External Content Type to be created and BCS to access your external data source, the data source credentials need to be stored. The Secure Store Service in SharePoint allows you to store credentials. For my scenario, a SQL database account was created named “AWDBAccount”. Therefore an entry in the Secure Store Service needs to be added for SQL Authentication.

Step 3: Create an External Content Type

The methods I describe in my books provides the steps for a no-code solution in creating an External Content Type that uses your data source as the provider of information via SharePoint Designer 2013.


Step 4: Set Permissions on the BCS Entity

I can imagine that this is often an overlooked step. Once the External Content Type is created, you need to give permissions to it, otherwise the search account as well as users will not be able to access the data.

Step 5: Create a Content Source for the External Content Type

In order to crawl the external data, you need to create a content source in Search.

Step 6: Create Managed Properties

After the crawl has completed, you now need to create managed properties and map them to the crawled properties from the new content source. This may be accomplished from the Search Service Application UI or from PowerShell. I describe both methods in my guide books.

Step 7: Create a Result Source

Step 8: Create a Result Type

Step 9: Create a Custom Search Results Page

Step 10: Add the Custom Search Results Page to the Search Navigation

Step 11: Test the Results


The results won't look too pretty. The remaining steps involve creating custom search display templates to properly present the external data search results.

Step 12: Create a Display Template

Step 13: Create an Item Hover Panel

Step 14: Update the Result Type to use the Display Template

Step 15: Test the Overall Results


Conclusion

In just 15 simple steps you can integrate external data into SharePoint 2013 Search by using external content types and BCS. You can get the entire end-to-end solution steps in my guides or from my SharePoint 2013 Solution Series:


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

Saturday, July 13, 2013

SharePoint 2013 Search: Cascading Refinements of Multi-Value Properties

My cascading refinement solution builds upon the instant refinement solution described in my previous post. The modifications update the result counts in other multi-refinement property sections as well as disables the filters that are no longer available because of the initial refinement.

This post describes a high level overview of the steps necessary for the cascading refinement functionality. You may find the code and more detailed steps in my new Enhancing the Search Experience in SharePoint 2013 guide book.


Step 1: Store the Property Selected First

Since the cascading is based on the property that is refined first, you must store the property.
 

Step 2: Evaluate the List Data and Modify Accordingly

At the top of the file, create a new array to store and process the list data and previous refiners. Add logic to set the list data to the previous refiners.

Step 3: Determine if Filter is Still Available and Update the Refinement Count

Within the !hasNoListData condition block, change the refiners.push logic.
 

Step 4: Flag Filters that Should Be Disabled


Flagging the filters that should be disabled involves two modifications. The first is to add logic to the hasFilterTokens condition. The second portion involves adding an else condition to the hasFIlterTokens if statement.

Step 5: Save Changes to the Template File


Step 6: Modify the Body Display Template

Within the for-loop, create an isDisabled variable and a fontWeight variable.
In the isSelected if statement, add fontweight=”bold”; :
Branch the else statement to check for isDisabled.

For the disabled version, just copy the input for the unselected check box but add the disabled=”disabled” property.

Finally in the label, add the a style property using the fontWeight variable.

Save the changes to the body file.

Step 7: Test the Cascade Functionality


Navigate to the search results page that contains the multi value refinements:


 
Click on one of the filters.
 
GET ALL OF THE CODE AND DETAILED STEPS IN MY NEW SEARCH EXPERIENCE GUIDE:

 

SPECIAL LOW KINDLE PRICE!!!

SharePoint 2013 Search: Instant Refinement of Multi-Value Properties - No Need to Apply

Overview
When you configure a refinement as multi-value, the user is presented with the list of available filters with checkboxes:

The user must select one or more checkboxes and then click on the Apply link. After they click on the Apply link, the results are refined by the selected filters but only the selected filters are presented:

With my Instant Refinement solution, all filters are displayed all of the time and when the user clicks on a checkbox, the results are instantly refined without the need to click on an Apply link.
This post describes a high level overview of the steps necessary for the instant refinement functionality. You may find the code and more detailed steps in my new Enhancing the Search Experience in SharePoint 2013 guide book.
 
 
Modification Steps
 

Step 1: Modify or Copy the Multi Value Display Template


Using SharePoint Designer 2013, navigate to the Filters display templates. Copy or modify the Filter_MultiValue.html file. Edit the file in advanced mode.

Step 2: Store the Original Filters

At the bottom of the display template add code to store the original set of refiners in a property of the RefinementControl object.

<!--[endif]-->

Step 3: Retrieve the Original Refiners

At the top of the display template you need to create a new array to store the original filters. Along with this you need to add logic to retrieve the previous refiners if they exist.

Step 4: Remove Condition from theRefiners Collection Creation

Scroll down the !hasNoListData condition block and remove the !hasAnyFilterTokens && check from the condition inside.

Step 5: Change Filter Tokens Logic

Scroll down to the hasAnyFilterTokens condition block and replace the refiners.push statement with code that just sets the IsSelected property to true if the refiner has been checked by the user.


Step 6: Save the Template Changes


 

Step 7: Modify the Controls in the Body Template


Modify or copy the Filter_MultiValue_Body.html file. Edit the file in advanced mode. Scroll to the bottom and find the submit link. Copy the onclick property. Paste the onclick into the checkbox inputs. Remove the Other and Submit divs sections from the bottom. Save the changes to the body file.

Step 8: Test the Changes

Navigate to your search page that contains the multi value refinements and review the experience:


 




You may click on each checkbox and watch the results instantly refine while always displaying all possible filters!!!

I improved this even further by creating a cascading solution for when you have multiple multi-value refinements!

GET ALL OF THE CODE AND DETAILED STEPS IN MY NEW SEARCH EXPERIENCE GUIDE:

 

SPECIAL LOW KINDLE PRICE!!!

Tuesday, July 2, 2013

SharePoint 2013 Search: Setting All Search Boxes to Use Your Search Center

Search boxes that appear on your sites and sub-sites will automatically render local results first and if you have the global search center set in your Search Service Application, a link appears to "expand your search" which then navigates to your search center.

You may configure the search boxes to navigate to your search center at both the site collection and site level. This is performed under Site Settings -> Site Collection Administration -> Search Settings for the site collection and Site Settings -> Search -> Search Settings for the site level. If you configure these settings at the site collection level, the same settings will be used for all sites within the site collection unless modified.

In setting up our new SharePoint 2013 farm, navigating through hundreds of site collections to modify these settings was not an option. Therefore I wrote a simple PowerShell script to loop through all site collections within a given web application and apply the search center URL and result page to them:

$SPWebApp = Get-SPWebApplication http://sp2013
foreach ($SPSite in $SPWebApp.Sites)
{
    if ($SPSite -ne $null)
    {
        $web = Get-SPWeb $spsite.Url       
        $web.AllProperties["SRCH_SB_SET_SITE"] =  

                {"Inherit":false,"ResultsPageAddress":"/sites/SearchCenter/Pages/results.aspx","ShowNavigation":false}'
        $web.AllProperties["SRCH_ENH_FTR_URL_SITE"] = '/sites/SearchCenter/Pages'
        $web.Update();

    }
}


EASY!


I found a post here that shows how to loop through each sub-site (SPWeb) and set the settings at the site level, however, I believe I have achieved my goal just by setting these values at the site collection level.



 

Monday, June 24, 2013

SharePoint 2013 Search: Adding Search Result Counts to Your Refinements

Overview
The Refinement web part has the ability to display result counts along side the refinement values for a particular managed property out-of-the-box. However, this option is not available within the web part properties. Enabling search result counts in your refinements requires a tweak within the refinement display templates.

Displaying Counts for All Refinements
The easiest configuration is to simply turn counts on for all refinements. This is achieved by modifing the Filter_Default.html and Filter_MultiValue.html display templates. Using SharePoint Designer 2013, you may access the display templates easily by following the similiar steps as outlined here.

This time instead of opening the Search sub-folder under Display Templates, open the Filters folder:

 
Locate Filter_Default.html. Right-click the file and select Edit File in Advanced Mode:


Inside the code locate the ShowCounts variable and change from false to true:

 
Save the changes. Your single value refinements now display the counts. Repeat the same process on the Filter_MultiValue.html to display counts on your multi-value refinements.
 
Displaying Counts for Selective Refinements
There may be situations or search pages where you do not wish to display the refinement counts. For this case, and for best practices sake, it is recommended to make a copy of the Filter templates and create a custom refinement display template accordingly.
 
Simply right-click the Filter_Default.html file and select Copy:


Right-click again and select Paste:

 
Rename the file accordingly:
 


Edit the new copied file and change both the Title and ShowCounts values:

 
Save the changes. Repeat the same process for the Filter_MultiValue.html if desired.
 
Now when configuring the Refinement web part, when you choose the refiners, your new display template is available in the drop-down:
 


 
You may now choose to show refinement counts on single and/or multi-value refinement properties:
 



Search On!

 

Wednesday, June 12, 2013

SharePoint 2013 Search: Getting a Value From the Previous Search Result

If you have been playing around with the new Search Display Templates, you have probably seen lots of references to ctx.CurrentItem. This is the current search result item from the result set. However, what about the previous item? Maybe you want to group results or only display certain values if the previous value is different than the current value. The value may be of any managed property or regular property of the CurrentItem object.

There isn't a PreviousItem object so I needed to figure out a different way to get to the previous item. The CurrentItem has a ParentTableReference which contains a collection of ResultRows. Perfect!

The ctx object stores the CurrentItemIdx which can be used to get a particular ResultRow and any property of the search result object (treat it like the CurrentItem).

So now I can get any result value relative to the current result item by using the index as a pointer. The previous item would be ctx.CurrentItemIdx - 1 and the next item would be ctx.CurrentItemIdx + 1.

Here is the logic in a nutshell:

<!--#_ 
        if (!Srch.U.n(ctx.CurrentItem.ParentTableReference) && ctx.CurrentItem.ParentTableReference.TotalRows > 1) {
           var previousIndex = ctx.CurrentItemIdx - 1;
           if (previousIndex >= 0)
           {
                var previousValue = ctx.CurrentItem.ParentTableReference.ResultRows[previousIndex].<<property>>;
               <<<add other conditions and set flags here>>
           }
        }
_#-->



You can now check the previous value of a property against the ctx.CurrentItem value of the property and alter the display or perform other functions accordingly.

Let me know if you find a better way!


 

Wednesday, June 5, 2013

SharePoint 2013 Search: Adding a New Admin Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new admin component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi

(The full script contains a loop that waits for the service to come online)

Clone Active Search Topology$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Add New Admin ComponentNew-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $ssi



Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa



Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa


(The full script contains a loop that waits for the index component to be Active)

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information.

Once all components are Active, reviewing the Search Application Topology in Central Admin shows the following:


My second search server was now complete!


FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


#Clone Active Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Add New Admin Component
New-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $ssi

#Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

SharePoint 2013 Search: Adding a New Analytics Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new analytics component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi

(The full script contains a loop that waits for the service to come online)

Clone Active Search Topology$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Add New Analytics Processing Component
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi



Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa



Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa


(The full script contains a loop that waits for the index component to be Active)

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information.

Once all components are Active, reviewing the Search Application Topology in Central Admin shows the following:

NEXT, I created a New Admin Component.



FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


#Clone Active Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Add New Analytics Processing Component
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi

#Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

SharePoint 2013 Search: Adding a New Content Processing Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new content processing component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi

(The full script contains a loop that waits for the service to come online)

Clone Active Search Topology$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Add New Content Processing Component
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi


Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa



Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa


(The full script contains a loop that waits for the index component to be Active)

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information.

Once all components are Active, reviewing the Search Application Topology in Central Admin shows the following:


NEXT, I created a New Analytics Component.


FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


#Clone Active Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Add New Content Processing Component
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi

#Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

SharePoint 2013 Search: Adding a New Crawl Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new crawl component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi

(The full script contains a loop that waits for the service to come online)

Clone Active Search Topology$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active



Add New Crawl Component
New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $ssi




Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa



Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa


(The full script contains a loop that waits for the index component to be Active)

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information:




Once all components are Active, reviewing the Search Application Topology in Central Admin shows the following:
 



NEXT, I created a New Content Processing Component.


FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


#Clone Active Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Add New Crawl Component
New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $ssi


#Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

SharePoint 2013 Search: Adding a New Index Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new index component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi


(The full script contains a loop that waits for the service to come online)

Clone Active Search Topology$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Create New Index Component for Index Partition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "<<server index location>>"


Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information:

 
 
(The full script contains a loop that waits for the index component to be Active)





 
 
 
Once all components are activated, reviewing the Search Application Topology in Central Admin shows the following:
 


NEXT, I created a New Crawl Component.
 

FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


#Clone Active Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


#Create New Index Component for Index Partition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "<<server index location>>"


#Activate the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

 

Matched Content