Test the FAST Search for SharePoint installation:
  1. Feed a test document
  2. Confirm that document can be retrieved via search
  3. Delete the test document
This script is useful for validating that your FAST install is working before you attempt to hook up the SharePoint service applications.  It assumes that you are running it from a server that has FAST the search role (qrserver).
PowerShell
Edit|Remove
<# 
.SYNOPSIS 
    Test the FAST Installation for basic indexing and search functionality 
.DESCRIPTION 
    Test the FAST Installation: 
        1. Feed a test document 
        2. Confirm that document can be retrieved via search 
        3. Delete the test document 
.NOTES 
    File Name : Test-FastInstallation.ps1 
    Author    : Matthew King <matthew.king@microsoft.com> 
 
#> 
 
$guid = [string][System.Guid]::NewGuid() 
$tempFile = "$guid.txt" 
 
Push-Location $env:TEMP 
try { 
    $guid > $tempFile 
 
    Write-Host "Adding our test document... " -NoNewline 
    $output = docpush -sp $tempFile 
    if ($?) { 
        Write-Host "OK" 
    } 
    else { 
        $output 
        return 
    } 
} 
finally { 
    rm $tempFile 
    Pop-Location 
} 
 
function Test-FASTSearch { 
    param( 
        [string]$Query = "meta.collection:sp", 
        [int]$baseport = 13000 
    ) 
 
    Add-Type -AssemblyName System.Web 
 
    $equery = [System.Web.HttpUtility]::UrlEncode($Query) 
    $hits = 1 
    $port = $baseport + 280 
    $url = "http://localhost:$port/cgi-bin/asearch?query=$equery&hits=$hits"  
    $web = New-Object Net.WebClient 
    $response = $web.DownloadString($url) 
    $totalHits = -1 
    if ($response -match "#CNT (\d+)") { 
        $totalHits = $matches[1] 
    } 
    $totalHits 
} 
 
[xml]$xml = Get-Content (Join-Path $env:FASTSEARCH "etc\Node.xml"$baseport = $xml.config.baseport 
 
$query = "`"$guid`"" 
Write-Host "Searching for it... " -NoNewline 
$found = $false 
for ($i=0; $i -lt 5; $i++) { 
    if ($i -gt 0) { 
        Write-Verbose 'Not found... sleeping for 10 seconds' 
        Start-Sleep 10 
    } 
 
    $hits = Test-FASTSearch $query $baseport 
    if ($hits -eq 1) { 
        Write-Host 'Found it!' 
        $found = $true 
        break 
    } 
    elseif ($hits -gt 1) { 
        Write-Warning "Found more documents than expected" 
        break 
    } 
    elseif ($hits -eq -1) { 
        Write-Error "Something bad happened" 
        break 
    } 
} 
if (-not $found) { 
    Write-Error "Failed to find our document" 
} 
else { 
    Write-Host "Deleting test document... " -NoNewline 
    $output = docpush -sp --u http://cohowinery.com/ $tempFile 
    if ($?) { 
        Write-Host "OK" 
    } 
    else { 
        $output 
    } 
}