Categories: FAST Search Server 2010, SharePoint 2010 Posted by TK on 11/20/2010 7:02 AM | Comments (1)

Page copy protected against web site content infringement by Copyscape

 

FAST Search for SharePoint 2010 - Using PowerShell to execute searches.
In some cases, you may want to test query results and there is a relatively easy way to do using PowerShell.


General steps are:

 
1) Pass the site URL to the Search object
2) Pass the QueryText (the query that you want to test)
3) Set search parameters
4) Execute query and format the results


Here is the code:

   1:  #load the site and set the keyword query object
   2:  $searchSite = Get-SPSite http://www.sathishtk.com
   3:  $keywordQuery = New-Object Microsoft.Office.Server.Search.Query.KeywordQuery $searchSite
   4:  $keywordQuery.ResultTypes = [Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults
   5:  # activate FQL queries
   6:  $keywordQuery.EnableFQL = 1 
   7:  $keywordQuery.RowLimit = 10
   8:  #Pass the query text - SharePoint
   9:  $keywordQuery.QueryText = "SharePoint"
  10:  #query execution
  11:  $results = $keywordQuery.Execute()
  12:  #display total number of rows
  13:  Write-Host Total hits: $results[1].TotalRows
  14:  $resultsTable = $results.Item([Microsoft.Office.Server.Search.Query.ResultType]::RelevantResults)
  15:  $resultsDataTable = $resultsTable.Table
  16:  # display the results in table format for better view
  17:  $resultsDataTable | Format-Table -AutoSize -Property title, url

Comments

trackback
Dark Corners: A Blog about Fast Search Server 2010 on 1/30/2012 4:45 AM POC - Part 2b: PowerShell: Configuring the connector/Indexing Content

The POC - Part 2 post was quite underwhelming. The VHD has all the software installed for us and stealing

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading