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

January 21, 2021

Implement Search for a Specific Column of Document Library in SharePoint Online

Overview

We at Binary Republik recently implemented the intranet solution for an Engineering & Construction company having headquarters in Boston, Massachusetts, United States. Implementing the tailored search for SharePoint Online - Modern Sites was also the part of requirements. The main purpose of the custom search implementation was to avail the results from a specific Document Library that will target the query on a specific column only.

Example

Let’s consider an example of one of the Document Libraries on our SharePoint site. Let’s say if we have a custom property for our document and when we search the document with that property it should find the document with its value. We want to implement a custom search for a specific document library column. Then how can we implement this?

So, now let’s check the overall procedure.

1.     Create custom properties for the column we wish to configure search.

2.     Go to site setting of the site.

From Site Collection Administration, go to Search Schema. We will be able to see all the manage properties of the site.

URL: https://yourtenant.sharepoint.com/sites/SiteName/_layouts/15/listmanagedproperties.aspx?level=sitecol

3.     To enable column search, we need to create a new custom property.

4.     Select New Managed Property.

5.     Give Name, Description (optional), and Type for the property.

6.    Check the checkbox for Searchable and also for Queryable. This is used the enable the column searches and enable the query for that column.

 7. Check the checkbox for Retrievable for retrieving the column in search call. If we need multiple values from this column, we can check the checkbox "Allow multiple values".


8.  Set the Alias to this property. We can also search based on this alias name instead of the property name.


9. We have to map this managed property with the Crawled Property (the column created in the Document Library should appear in the Crawled Properties). Click on "Add a Mapping".

 

10.  After that search the column name and click on the "Find" button. We are able to see all properties related to the column name, select the appropriate one and click "OK".

11.  Once we add the property, we will be able to see on the below screen.

So, this is how we can configure, managed property for a SharePoint - Document Library column.

Important Notes

·       If we want to implement search on multiple columns, then we need to repeat steps 1 to 11 for each property.

·       After creating custom properties that’s column will be searchable. This will take around 24 hours to crawl this column.

Usability of the Property

E.g.: We need to search "02265" cell phone number. So, we add this number with 'querytext' and we also use 'selectproperties' to select our "Cell Phone". It will search the cell phone number and as result, it will show in cell phone column value.

We can use the following syntax to search in a different manner. We can integrate the same Search API in the SPFx webparts or custom solutions to be implemented.

Conclusion

This is how we can configure the search to target the specific column of SharePoint Document Library!

If you have any questions you can reach out our SharePoint Consulting team here.

March 9, 2017

Add/Move SharePoint 2013 farm Search Topology in Single or Multiple Search Servers using PowerShell

SharePoint 2013 farm provides Search Topology that comprises Admin, Crawler, Content Processing, Analytics Processing, Query Processing and Index Partition.

  • Search Administration Component administers new instances of Search components and Search processes.
  • Search Crawler enables us to crawl all the content in our site thereby allowing us to retrieve results via SharePoint Search. 
  • Search Content Processing allows us to process different types of contents and indexing them in a single index.
  • Search Analytics Processing component of Search topology deals with analytics related stuffs. It carries out search analytics and usage analytics.
  • Search Query Processing component handles incoming queries and returns suitable results.

Scenario 1: If you want to move SharePoint 2013 farm Search Topology from one server (e.g. Server1) to another (e.g. Server2), then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search Topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any of your SharePoint 2013 farm server and run SharePoint Management Shell as an Administrator. 

Run below given commands in SharePoint Management Shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, where we want to move Search Topology.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 0
Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, Search Topology will be migrated from "Server1" to "Server2", and you will be able to see Search Topology components in "Server2".

*After moving Search Topology to new server, start full crawl to get search results.

Scenario 2: If you want to add an additional search server (e.g. Server2),  along with existing search server -- Server1, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 
Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 1
# Note: For Adding second Search Server Topology, we must have to give -IndexPartition as 1. Because, "Server1" would already have 0 as IndexPartition.

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

Scenario 3: If you want to add multiple search servers (e.g. Server1 and Server2) at a time, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Server1 and Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 

Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server1"
$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server1" and "Server2" are new servers, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Start-SPEnterpriseSearchServiceInstance -Identity $hostB
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostB
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 0

New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostB -IndexPartition 1
# Note: For adding an additional search server in farm, we must give -IndexPartition 1

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

If you have any questions you can reach out our SharePoint Consulting team here.