This tool will import SP2007, SP2010 or custom Keyword|BestBet|Synonyms that are already available in CSV format to FS4SP.

<!-- ESG Keyword Import/Export Tools Configuration File  -->

<!-- Contains Configuration for scripts that:    -->
<!--   Microsoft Search Server 2007 -> CSV   -->
<!--   Microsoft Search Server 2010 -> CSV   -->
<!--   CSV         -> FS4SP   -->

<config>
 <export_SP2007_CSV>
  <!-- The Microsoft Search Server 2007 site to export keywords/bestbets/synonyms into CSV files-->  
  <SPsiteURL>http://fs14/</SPsiteURL>  
  <!-- The path+filenames for the output CSV files -->
  <output_keywordsfile>.\csv\keyword.csv</output_keywordsfile>
  <output_bestbetsfile>.\csv\bestbet.csv</output_bestbetsfile>
  <output_synonymsfile>.\csv\synonym.csv</output_synonymsfile>
 </export_SP2007_CSV>
 
 
 <export_SP2010_CSV>
  <!-- The Microsoft Search Server 2010 site to export keywords/bestbets/synonyms into CSV files -->
  <SPsiteURL>http://fs14/</SPsiteURL>  
  <!-- The path+filenames for the output CSV files -->
  <output_keywordsfile>.\csv\keyword.csv</output_keywordsfile>
  <output_bestbetsfile>.\csv\bestbet.csv</output_bestbetsfile>
  <output_synonymsfile>.\csv\synonym.csv</output_synonymsfile>
 </export_SP2010_CSV>

 
 <import_CSV_to_FS4SP>
  <!-- The FS4SP SearchGroupSetting id you want to import into --> 
  <siteid>6feff133-68c0-4e8d-a8b4-88633ddc40c2</siteid>
  <!-- The path+filenames for the input CSV files -->
  <keywordsfile>.\csv\keyword.csv</keywordsfile>
  <bestbetsfile>.\csv\bestbet.csv</bestbetsfile>
  <synonymsfile>.\csv\synonym.csv</synonymsfile>
  <createSiteGroupIfNotExist>False</createSiteGroupIfNotExist>
 </import_CSV_to_FS4SP>
</config>

PowerShell
Edit|Remove
# 	ESP - FS4SP Keyword Import Tool from MOSS CSV files v.0.1
#
#	This tool will import SP2007, SP2010 or customn Keyword|BestBet|Synonyms that are already 
# 	available in CSV format to FS4SP. For more details check the documentation on the requirements.
#
         
cls
     
$keywordCache = @{}
$global:configFile = ""
$global:siteid=""
$global:keywordsfile=""
$global:bestbetsfile=""
$global:synonymsfile=""
$global:createSiteGroupIfNotExist=""

function GetKeyword($term) {
  $keyword = $keywordCache[$term]
  if($keyword -eq $null) {
    $keyword = $ssg.Keywords.GetKeyword($term)
    if($keyword -ne $null) {
      $keywordCache[$term] = $keyword
    }
  }
  $keyword
}  
function AddKeyword($term) {
  $keyword = GetKeyword($term)
  if($keyword -eq $null) {
    $keyword = $ssg.Keywords.AddKeyword($term)
    $keywordCache[$term] = $keyword
  }
  $keyword
}

function ProcessConfigFile($configFile)
{
	write-host ("[STATUS] Processing config file : " + $configFile) -ForegroundColor green
	
	$doc = New-Object System.Xml.XmlDocument 
	$doc.Load($configFile) 

	$global:siteid = $doc.config.import_CSV_to_FS4SP.siteid
	$global:keywordsfile = $doc.config.import_CSV_to_FS4SP.keywordsfile
	$global:bestbetsfile = $doc.config.import_CSV_to_FS4SP.bestbetsfile
	$global:synonymsfile = $doc.config.import_CSV_to_FS4SP.synonymsfile
	$global:createSiteGroupIfNotExist = $doc.config.import_CSV_to_FS4SP.createSiteGroupIfNotExist
	
	write-host ("[STATUS] Using these configurations: `n") -ForegroundColor green
	write-host ("`t siteid : " + $siteid) -ForegroundColor green	
	if(checkFile($keywordsfile))	
    { 
      write-host ("`t keywordsfile : " + $keywordsfile) -ForegroundColor green 
    } 
    else 
    { 
      write-host ("[Error ] File does not exist : " + $keywordsfile) -ForegroundColor red ; exit
    } 
	if(checkFile($bestbetsfile))	
    { 
      write-host ("`t bestbetsfile : " + $bestbetsfile) -ForegroundColor green 
    } 
    else 
    { 
      write-host ("[Error ] File does not exist : " + $bestbetsfile) -ForegroundColor red ; exit
    } 
	if(checkFile($synonymsfile))	
    { 
      write-host ("`t synonymsfile : " + $synonymsfile) -ForegroundColor green 
    } 
    else 
    { 
      write-host ("[Error ] File does not exist : " + $synonymsfile) -ForegroundColor red ; exit
    } 
}

function checkFile($path)
{	
	$status = Test-Path $path
		
	return $status
}

write-host ("---------`n ESP - FS4SP Keyword Import Tool v.0.1 ") -ForegroundColor yellow
write-host ("`n`n This tool will import CVS files for `n keywords/bestbets/synonyms in to a FS4SP setup.`n-----`n`n") -ForegroundColor yellow

if (!$args)
{
	write-host ("You must specificy command line arguments") -ForegroundColor red
	write-host ("Try : -? for more info") -ForegroundColor red
}
else
{
	switch($args)
	{
		"-c" { 
				if ($args[1] -ne $null)
					{ 
						write-host ("[STATUS] Will use config file : " + $args[1] +"") -ForegroundColor green
						$global:configFile = $pwd.path + $args[1]												
												
						if (checkFile($configFile)) { ProcessConfigFile($configFile) }
						else { write-host ("[Error ] Config file " + $configFile + " does not exist!`n`n") -ForegroundColor red ; exit}												
					}
				else 
					{ 
						write-host ("[Error ] Need to specify the config file...!") -ForegroundColor red
					}
			 }		
		"-?" { $help = "`n`n Definition : `n`n This tool is used for importing CSV files for keywords/bestbets/synonyms into a FS4SP Setup."+
                       "`n Make sure you have correct config file, and the CSV files are in correct format. `n`n Example: .\import_CSV_FS4SP.ps1 "+
                       "-c .\configuration.xml`n`n" ; write-host $help ; exit }
	}
		
	
	$ssg = Get-FASTSearchSearchSettingGroup -name $siteid 2>$null
	if($ssg -eq $null)
	{
		if ($global:createSiteGroupIfNotExist -eq "True")
		{
			write-host ("[Warning] Siteid : " + $global:siteid + " does not exist will be creating it...") -ForegroundColor red
			$ssg= New-FASTSearchSearchSettingGroup -name $global:siteid
		}
		else
		{
			write-host ("[Error ] SiteID does not exist, make sure you configure it correctly in the config file! ") -ForegroundColor red
			exit
		}
	}

	#Import the csv files
	$keywords = import-csv -Path $global:keywordsfile
	$bestbets = import-csv -Path $global:bestbetsfile
	$synonyms = import-csv -Path $global:synonymsfile

	write-host ("`n[STATUS] Adding " + $keywords.Count + " keywords...") -ForegroundColor green

	foreach ($kw in $keywords)
	{
	  $term = $kw.SpecialTerm
	  $keyword = AddKeyword($term)
	}
	write-host ("[STATUS] Adding " + $keywords.Count + " keywords...Done") -ForegroundColor green
	write-host ("[STATUS] Adding " + $bestbets.Count + " bestbets...") -ForegroundColor green

	foreach ($bb in $bestbets)
	{
	  $term=$bb.SpecialTerm
	  $kw = GetKeyword($term)
	  if($kw -ne $null) {
		if(!$kw.BestBets.ContainsBestBet($bb.Title)) {
		  $kwbb = $kw.BestBets.AddBestBet($bb.Title)
		} else {
		  $kwbb = $kw.BestBets.GetBestBet($bb.Title)
		}
		$kwbb.Description = $bb.Description
		$kwbb.Uri = $bb.URL
	  } else {
		write-host "[Warning] The keyword with term $term does not exist" -ForegroundColor red
	  }
	}
	write-host ("[STATUS] Adding " + $bestbets.Count + " bestbets...Done") -ForegroundColor green 
	 

	write-host ("[STATUS] Adding " + $synonyms.Count + " synonyms...") -ForegroundColor green
	foreach ($synonym in $synonyms)
	{
	  $term=$synonym.SpecialTerm
	  $kw = GetKeyword($term)
	  if($kw -ne $null) {
		if(!$kw.Synonyms.ContainsSynonym($synonym.Synonyms)) {
		  $kwbb = $kw.Synonyms.AddSynonym($synonym.Synonyms)
		}
	  } else {
		write-host "[Warning] The keyword with term $term does not exist" -ForegroundColor red
	  }
	}
	write-host ("[STATUS] Adding " + $synonyms.Count + " synonyms...Done") -ForegroundColor green	
}