Configure Search in SharePoint Server 2016



Published: 30 September 2017

Search is one of the most widely used features of SharePoint Server which helps users to fetch relevant information by typing in related information in the search box. However, for search to work, we have to set up Search Service in the server first. In this article, we will see how to configure search in SharePoint Server 2016. 

SharePoint Search architecture is made up of the below components.

  • Crawl and content processing
  • Index
  • Query processing
  • Search administration
  • Analytics

A successfully configured Search Service will have all the above components working in unison. Each of the components will have a database created in the SQL Server. On a high level, the crawl component is responsible for crawling the SharePoint content and collects the crawl properties which will in turn be sent to the content processing component. The content processing component receives the crawled properties, processes it and sends it to the Index Component. 

The index component receives the processed items from the content processing component and writes it to the search index. At the same time, it is responsible for returning the results for a search query from the search index.

When the user inputs a search query and presses enter, the query is processed by the Query Component and is submitted to the Index Component for data retrieval from search index.

Search administration component performs the overall administration of Search like instantiating search service instance and related components.

Image Source : MSDN

Once the search has been configured in SharePoint Server 2016, we can see the component health status, as shown below:

Thus, we have a bird’s eye view of the search components and how they are linked to each other.

We will configure Search by following the below steps :

  • Create a Managed account  
  • Create the Search Service Application
  • Create a Content Source
  • Create Search Center

Create Managed Account

Before creating the Service Application, we have to ensure that we have a manage account that will be associated with the Search Service. Though the farm account is available as a managed account, the best practice is to create a managed account dedicated to search. Lets create the managed account by going to the Security tab in the Central Administration. 

Specify the account name and password and click on OK to create the managed account. 

Create Search Service Application

So as to get started with search, the primary step that has to be done is to create a Search Service Application which will in turn provision the search components. From the ‘Manage Service Applications’ page, select ‘Search Service Application’.

This will open up the Search Service application page where we can specify the service application name and Search Service account.

We can also specify the Application pools that will be used by the search admin web service and the query web service.We can either use the existing app pools or create a new app pool during the Search Service application creation. 

Click on OK to start the provisioning of the search service application.

The provisioning will take some time to complete.

Finally, the service application has been created.

Heading over to the service applications list, we can see the new search service application listed out.

We have to make sure that the SharePoint Server Search Service is up and running in the Manage Services on Server page.

Create a Content Source for the Search Service Application

Once the search service is running, go to the search administration page and select the ‘Content Sources’ option from ‘Crawling’ section.

This will take us to the page where the Content Sources are listed out. Each content source can contain multiple SharePoint web application URL which will be crawled by the crawl and content processing component during the crawl schedule.

Clicking on the default ‘Local SharePoint sites’ will take us to the page where the ‘Start Addresses’, from where crawl will start, will be listed out. We can add new URLs or edit existing ones here.

We can choose the crawl schedules to be either incremental or continuous crawl. When a full crawl does a sweep through the entire content, Incremental schedule crawls only the updated content from a previous crawl. However, if there is frequent updates to the content, in order to update the search index in real time, continuous crawl can be scheduled. By default, continuous crawl is set to run every 15 minutes.

In case we need to crawl specific SharePoint URL, we can create a new content source. Adding all the SharePoint URLs in one single content source has a demerit – If we want to run a crawl only over a single SharePoint URL and the Content Source contains a lot of other URLs in addition to our target URL, the crawl takes a long time to complete.

Once the content source is in place, we can start a full crawl.

We can see the duration of the crawl under ‘Current crawl duration’.

Depending on the content size, search crawl may complete in few minutes time or can take from hours to days. Incremental crawls will only crawl the latest content added to SharePoint which reduces the crawl time.  As a usual practice after doing a Full Crawl, we can schedule incremental crawls to take care of the newly added content.

 However you will have to manually do a full crawl in either one of the scenarios to ensure that Search service is in a healthy state.

  • You have configured search for the first time
  • You have added a new managed property and for it to be used with search results
  • You recently had a software/Service Pack/Feature Pack  in the farm.
  • You have a corrupted index
  • New Crawl rules have been added/updated/deleted 

Now, let’s head over to a document library and try to do a search for a document.

The search results has started coming up in the results page. 

Thus, we saw how to configure search in SharePoint Server 2016.

Debugging Search Configuration Issues

During/After search configuration, when we go to the search service application page, there can be chances that the components that are associated with search are not setup correctly. Usually this happens when we create the search service through UI and some time out happens. When we opt for PowerShell to create Search Service application, these kind of errors are less prone. 

 Some of the debugging steps we will usually do is make sure that the Search Service is running by going to the Central Administration ->  Services on Server -> SharePoint Server Search

If it is running, head over to Services.msc and ensure that the below services are running :

  • SharePoint Server Search 16
  • SharePoint Server Search Host Controller

If any one of them are disabled, start the service. 

We can also check the status of the Search Host Controller, which manages the search topology components , by using PowerShell

Get the SharePoint Search Instance and start the service using the below command :

Get-SPServiceInstance | ? {$_.TypeName -eq "Search Host Controller Service"}

Start-SPServiceInstance -Identity 90fb1e62-1f93-4b95-9844-6b8db32838fd

The change in the status after running the command can be seen below:

Checking the service console, we can ensure that the service has been started. 

Now if we head over to the Service Application, we can see the tick mark against each component that ensures that the components are healthy. 

Create Search Center

Having a search center helps to redirect the search results to a common page. This helps to customize the common Search results page which can be used by multiple site collections. Else we would have to customize the search page for each site collection. 

Setting up of a Search Center involves the below steps :

·         Creation of a Search Center Site Collection

·         Setting the Search Center URL in the Search Service Application

·         Setting the Search Center URL in the Site Collection Search Settings page. 

By default, if we search using the Out of the Box search box it will navigate to the results page of site collection:

Lets see how to create a search center and use it as the common search results destination. Head over to the Create Site Collection option. 

We can specify the search center title ,description and url in the below page. 

In the template section we can either specify the Enterprise Search Center or Basic Search Center option and specify the site collection administrator. 

Assign the Global Search Center Location

Now we have to set the global search center location in the Search Service Application as shown below :

Upon Clicking the location link, specify the search center URL in the pop up.

This will add the Global Search Center URL in the search service application. 

Assign Search Center in the Site Collection

As the last step lets assign the search center in the site collection by going to Site Settings -> Search Settings option. 

In the Search Center URL, specify the URL of the Site collection we created using Enterprise Search Center template. 

We will also select the radio button ‘send queries to a custom page URL’ and specify the value as <SearchCenterSiteURL>/Pages/results.aspx.

Once we have assigned these values, it will take 30 minutes for it to get reflected. Now if we search in this site collection, the results will be navigated to the Search Center Site as shown below :

Create Search Service Application Using Power Shell

So far we saw how to create the Search Service using UI. However, from personal experience, PowerShell has been more reliable when it comes to setting up Search Service. This is because, Search Service Provisioning through UI can get timed out at times and we will be left with a half cooked Search. In such a case we don’t have an option but to delete the corrupt search and recreate it.

So lets see how to make use of PowerShell to create Search Service Application in a Single Server Installation. We will see how to use PowerShell to provision search for a multi farm in a later article. 

As the first step, we will assign the PowerShell variables and create the Service Application Pool using the New-SPServiceApplicationPool command .

Once we have created the application pool, we will start the search service instance and create the search service application/proxy. After creating the service application, we will clone the search topology and assign the search components to it.

Now lets create the main 6 Search components using the below cmdlets :

·         Admin Component

·         Content Processing Component

·         Analytics Processing Component

·         Crawl Component

·         Query Processing Component

·         Search Index Component

Finally we will create the index component and activate the topology.

Using Get-SPEnterpriseSearchTopology we can get the recently activated Search Topology.

$ssa = Get-SPEnterpriseSearchServiceApplication

Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

We can also confirm the Search Service Application and the search components by going to the Central Administration -> Manage Service Applications -> Search Service Application

Delete Search Service

In case we want to delete and recreate the service application, we can do it directly from the UI as well as using PowerShell. From UI, we can head over to Central Administration -> Manage Service Applications -> Select Search Service Application

Click on Delete to delete the Search Service Application. 

Select the Checkbox to delete the service application databases along with the Service Application. 

Delete Service Application using PowerShell

We can delete the existing Service Application and the associated proxy using the below cmdlets. 

Summary

Thus we have seen how to create and configure Search Service Application in SharePoint 2016. Minroles is a new feature that helps to offload the SharePoint functionality across multiple optimized servers. One of the MinRoles available in SharePoint 2016 is the Search Minrole. In the upcoming article we will see how to configure search in SharePoint 2016 MinRole. 





Join 7,000 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers


About Author

Priyaranjan is a SharePoint Consultant with 7+ years experience in developing and deploying SharePoint Applications.He has worked on various SharePoint iterations starting from MOSS 2007 through SharePoint 2016 and Office 365. He is a frequent contributor at Microsoft TechNet and has won 33 Gold Medals in various TechNet Wiki Guru Monthly Competitions.As a token of appreciation for the TechNet community activities, he was interviewed by Microsoft Program Manager,Ed Price. He has also published 300 Articles and 4 SharePoint Ebooks in different technical communities.You can find his Microsoft TechNet contributions here