In this blog, we will learn about the default managed properties, their settings, and the default mapping between crawled and managed properties creation using PowerShell.
Managed Property
Managed properties can have a large number of settings or attributes. These attributes determine how the contents are shown in the search results.
For more details about the Properties, go to https://technet.microsoft.com/en-us/library/jj219630.aspx
Powershell Script
- #Search Service Application
- $category = Get - SPEnterpriseSearchMetadataCategory– SearchApplication $searchapp– Identity $_.Category
- $property = Get - SPEnterpriseSearchMetadataCrawledProperty - SearchApplication $searchapp - name $_.CrawledPropertyName - Category $category - ea silentlycontinue
- # If the Crawled Property is present
- if ($property) {
- #Check Managed Property already exists
- $ManagedProperty = Get - SPEnterpriseSearchMetadataManagedProperty - SearchApplication $searchapp - Identity $_.ManagedPropertyName - ea silentlycontinue
- if ($ManagedProperty) {
- Write - Host - f green” Cannot create managed property” $_.ManagedPropertyName“ Already exists”
- } else {
- #Create Managed Property
- New - SPEnterpriseSearchMetadataManagedProperty - Name $_.ManagedPropertyName - SearchApplication $searchapp - Type $_.Type - Description $_.Description
- $ManagedProperty = Get - SPEnterpriseSearchMetadataManagedProperty - SearchApplication $searchapp - Identity $_.ManagedPropertyName
- # Map the Managed Property with the Crawled Property
- New - SPEnterpriseSearchMetadataMapping - SearchApplication $searchapp - ManagedProperty $ManagedProperty– CrawledProperty $property
- }
- }
Conclusion
Was my blog helpful? If yes, please let me know and if not, please explain what was confusing or missing. I’ll use your feedback to double-check the facts, add info, and update this blog.