SharePoint 2010: How to Set Metadata Properties using Powershell
How to Set Attributes of Metadata properties for more than one property:
1. Reduce storage requirements for text properties by using a hash for comparison.
Solution:
Export and Import the Metadata Properties.
Get all the properties to a txt file like MetadataProperties.txt.
Run the below command where it set the Reduce storage requirements for text properties by using a hash for comparison.
Get-Content MetadataProperties.txt | Foreach-Object {
$prop = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $_ -SearchApplication "Search Service Application"
$prop.MaxCharactersInPropertyStoreIndex = 1
$prop.Update()
}
2. Add managed property to custom results set retrieved on each query. Note: Only the first 2 kilobytes of data is available for display by default.
Solution :
After the import it automatically sets above parameter. To check whether it has set or not use the below command.
Get-Content MetadataProperties.txt | Foreach-Object {
$prop = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $_ -SearchApplication "Search Service Application"
$prop.PutInPropertyBlob | out-file c:\PutInPropertyBlob.txt -append
}
check the status True in the output file PutinPropertyBlob.txt
If it shows false, you use the below command to set as well.
Get-Content MetadataProperties.txt | Foreach-Object {
$prop = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $_ -SearchApplication "Search Service Application"
$prop.PutInPropertyBlob = true
$prop.Update()
}