Smoke testing a FAST for SharePoint install

One of the things I like to do after first installing and configuring FAST, and before trying to connect the SharePoint SSA’s is to test the FAST install to make sure that basic indexing and search are working.   None of this is rocket science but I got tired of typing it by hand each time and wrapped it into a little PowerShell.

Here’s what we’re going to do:

  1. Index a text document using docpush
  2. Search for that document against the QR Server directly
  3. If successfully found, clean up and delete the document using docpush again

Rather than pushing the install info text file I like to create one using a GUID so I can be certain I’m searching for only one particular document:

$guid = [string][System.Guid]::NewGuid()
$tempFile = "$guid.txt"
$output = docpush -c sp $tempFile
if (-not $?) {
Write-Error $output
rm $tempFile

Now to do the search, let’s create a little helper function that will perform a search and return the total hits:

function Test-FASTSearch {
[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]

Look up the baseport and do a search:

[xml]$xml = Get-Content (Join-Path $env:FASTSEARCH "etc\Node.xml")
$baseport = $xml.config.baseport
$hits = Test-FASTSearch "`"$guid`"" $baseport

If you get back 1 hit then all is good.  More than one and somehow you’ve indexed that guid more than once.  -1 and the search failed.  If you get 0 then you should sleep a bit and try again.

All good and you can clean up the document using docpush and the -d switch:

$output = docpush -c sp -d -u $tempFile
if (-not $?) {
Write-Error $output

You can find the whole script out on the ScriptCenter gallery.

What other basic tests do you run after first installing FS4SP?

Comments (1)

Skip to main content