SharePoint 2010 FAST Search: How do I create Managed Properties?
I have delving into the wonders of FAST Search and found this very helpful script to create managed properties.
It definitely saved my a lot of time and headaches. Thank you Ivan Josipovic.
Here is a copied version of the text:
function New-FASTManagedProperty([string]$Name, [string]$CrawledPropertyName, [string]$Type,[bool]$Refinement,$Sortable)
{
if ( (Get-PSSnapin -Name Microsoft.FASTSearch.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.FASTSearch.PowerShell
}
switch ($Type)
{
"Text" {$type = "1"} #variant 31
"Integer" {$type = "2"} #variant 3
"Decimal" {$type = "5"} #variant 5
"DateTime" {$type = "6"} #variant 64
"Float" {$type = "4"} #variant 5 ?
"Binary" {$type = "3"} #variant 11
}
$managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name
if ($managedproperty -eq $null){
New-FASTSearchMetadataManagedProperty -Name $Name -Type $Type -ea 0
$managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name
}
Set-FASTSearchMetadataManagedProperty –Name $Name –Queryable $true –StemmingEnabled $false –RefinementEnabled $Refinement -SortableType $Sortable
$cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
if ($cp -eq $null){
switch($type){
"1" {$variant = "31"} #Text 31
"2" {$variant = "3"} #Integer 3
"5" {$variant = "4"} #Decimal 5
"6" {$variant = "64"} #DateTime 64
"4" {$variant = "5"} #Float 5 ?
"3" {$variant = "11"} #Binary 11
}
New-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName -Propset "00130329-0000-0130-c000-000000131346" -VariantType $variant
$cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
write-host "Created $($CrawledPropertyName) Crawled Property"
}
$property = Get-FASTSearchMetadataCrawledPropertyMapping -name $Name
if ($property -ne $null)
{
Remove-FASTSearchMetadataCrawledPropertyMapping –managedproperty $managedproperty -crawledproperty $cp -force
}
New-FASTSearchMetadataCrawledPropertyMapping –Managedproperty $managedproperty –crawledproperty $cp -ea 0
write-host "Created $($Name)"
}
It definitely saved my a lot of time and headaches. Thank you Ivan Josipovic.
Here is a copied version of the text:
function New-FASTManagedProperty([string]$Name, [string]$CrawledPropertyName, [string]$Type,[bool]$Refinement,$Sortable)
{
if ( (Get-PSSnapin -Name Microsoft.FASTSearch.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.FASTSearch.PowerShell
}
switch ($Type)
{
"Text" {$type = "1"} #variant 31
"Integer" {$type = "2"} #variant 3
"Decimal" {$type = "5"} #variant 5
"DateTime" {$type = "6"} #variant 64
"Float" {$type = "4"} #variant 5 ?
"Binary" {$type = "3"} #variant 11
}
$managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name
if ($managedproperty -eq $null){
New-FASTSearchMetadataManagedProperty -Name $Name -Type $Type -ea 0
$managedproperty = Get-FASTSearchMetadataManagedProperty –Name $Name
}
Set-FASTSearchMetadataManagedProperty –Name $Name –Queryable $true –StemmingEnabled $false –RefinementEnabled $Refinement -SortableType $Sortable
$cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
if ($cp -eq $null){
switch($type){
"1" {$variant = "31"} #Text 31
"2" {$variant = "3"} #Integer 3
"5" {$variant = "4"} #Decimal 5
"6" {$variant = "64"} #DateTime 64
"4" {$variant = "5"} #Float 5 ?
"3" {$variant = "11"} #Binary 11
}
New-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName -Propset "00130329-0000-0130-c000-000000131346" -VariantType $variant
$cp = Get-FASTSearchMetadataCrawledProperty -Name $CrawledPropertyName
write-host "Created $($CrawledPropertyName) Crawled Property"
}
$property = Get-FASTSearchMetadataCrawledPropertyMapping -name $Name
if ($property -ne $null)
{
Remove-FASTSearchMetadataCrawledPropertyMapping –managedproperty $managedproperty -crawledproperty $cp -force
}
New-FASTSearchMetadataCrawledPropertyMapping –Managedproperty $managedproperty –crawledproperty $cp -ea 0
write-host "Created $($Name)"
}
It can be invoked as follows:
New-FASTManagedProperty "ListItemID" "ows_id" "Integer" $true "1"
Comments
Post a Comment