Saturday, September 22, 2012

Fast Search Useful Links


Adding a Refiner to the Refinement Panel Web Part
 
Walkthrough: Querying FAST Search Server From a Client Application
 
 
 Creating FAST Search Managed Properties and Mappings to Crawled Properties with Powershell
 
 
Working with crawled and managed properties via code


FAST Search Query Integration Overview
http://msdn.microsoft.com/en-us/library/ff394628.aspx

 

Fail to add Managed Property

When adding additional crawled property to Fast search, the search properties file may not pick up the additional addon.

As an example, add an selected DB column on the crawling file. Do an incremental crawl. From the test search page: http://localhost:13280, do a simple search, fields displayed should contain managed property with or without retrieved data. If there is no such an addon property, then there is a issue to your query server.

First check if the managed property has been added to and mapped to the crawled property, then start a crawl.

Additional checks on Index schema. The Index Schema defined in SharePoint Central Administration at the Query SSA's FAST Search Administration section is stored in SQL Server, and deployed to FAST Search through a timer job. It's possible that not all steps of the deployment occur, leading to a newer schema in SharePoint / SQL than the FAST qrserver is using.

To resolve it restart the QR server:
nctrl stop qrserver qrproxy search-1
nctrl start qrserver qrproxy search-1

nctrl restart qrserver

If you ever an error like this: Property doesn't exist or is used in a manner inconsistent with schema settings.

If the files are in place on the FAST Admin node, they can also be pushed to the query servers by running the following in a command prompt at the %FASTSEARCH%\index-profiles directory:

bliss -C deployment-ready-index-profile.xml

Ultimately, the deployment from the configuration stored in SQL can be restarted by opening the FAST Search Server PowerShell and running:

$allmp = Get-FASTSearchMetadataManagedProperty
$firstmp = $allmp[0]
$firstmp.Update()
This will republish the Index Schema without any changes.

If in the search results, you see there are "BADHITS",

The messages generally indicate that files created during an index-profile update have not updated properly, thus causing inconsistency on the system.

To determine if the files were incorrectly generated by the configserver, do the following:

Stop FAST ESP (nctrl stop).
Clear the contents of %FASTSEARCH%\var\searchctrl\etc\* and %FASTSEARCH%\var\etc\*. (The files will be regenerated.)
Start FAST ESP (nctrl start).

After the crawled items are processed, they are stored in an XML-based format (FiXML files). The indexer uses the FiXML files as input to the indexing process.

The indexeradmin resetindex command re-builds the content index from the FiXML files. This is normally needed only if the content index files are corrupted or damaged.


Thursday, September 20, 2012

Create and Delete Mappings

#create managed property
$packsizemanagedproperty = New-FASTSearchMetadataManagedProperty -Name productpacksize -type 1 -description "Product Package Size"
#Set-FASTSearchMetadataManagedProperty -Name productpacksize -Queryable $true -StemmingEnabled $true -RefinementEnabled $true
$packsizecrawledproperty1 = Get-FASTSearchMetadataCrawledProperty -name "mpbio_packsize"
#create mappings
New-FASTSearchMetadataCrawledPropertyMapping -Managedproperty $packsizemanagedproperty -crawledproperty $packsizecrawledproperty1


#Delete Mappings
$packsizemanagedproperty = Get-FASTSearchMetadataManagedProperty -Name productpacksize 
$packsizecrawledproperty = Get-FASTSearchMetadataCrawledProperty | where-object {($_.Name -eq "mpbio_packsize") -and ($_.CategoryName -eq "JDBC")} 
Remove-FASTSearchMetadataCrawledPropertyMapping -Managedproperty $packsizemanagedproperty -crawledproperty $packsizecrawledproperty -Force
Remove-FASTSearchMetadataManagedProperty -Name productpacksize -Force

Monday, September 17, 2012

Context

string currentPage = "http://admin.xxxx.com/mx";

HttpContext.Current.Request.RawUrl.Substring(1, 2)); //mx


SPContext.Current.Site.RootWeb.Url //http://admin.xxxx.com

 SPContext.Current.Web.Url //http://admin.xxxx.com/mx

Thursday, September 13, 2012

Add Custom Property

1.      Add it in metadata (in MetadataDefintion.xml, locate basket entity and add the following)
<PropertyMapping property="MyCustomProp" csProperty="MyCustomProp "/>
...
<Property name="MyCustomProp" dataType="String" isStronglyTyped="false" />

2.      Set model property, for example, in the shoppingcontroller.cs

In AddBasketLineItemCreateRequest function, add the following after the last line of this function.
builder.Model.Properties["MyCustomProp"] = "value";

Then when you add item to your basket, this MyCustomProp is available in basket pipeline.

You probably want to add the same to other type of requests, such as AddBasketLineItemUpdateRequest, AddBasketLineItemDeleteRequest, etc. based on your business need.

3.      access it in Pipeline through order dictionary indexer
orderDictionary["MyCustomProp"]

Remote Debugger

Very good article on how to set up remote debugging: http://msdn.microsoft.com/en-us/library/bt727f1t.aspx

At the remote machine, the msvsmon.exe has to be started by using administrator's credential:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x64
 

Friday, September 7, 2012

Create List and Add Column to the List

Create List
Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
try
{
$TestSiteUrl = "http://mysitecollection/mysite" #provide site url in this variable
$ListName = "EmpInfo"   #listName
$ListDescription = "Employee information list" #list description
$myTestWeb = Get-SPWeb -identity $TestSiteUrl   #Get web object
$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList  #GenericList template
write-host "Adding list" $ListName
#column1 schema xml
$firstNameColXml = "<Field Type='Text' DisplayName='FirstName' Required='TRUE' EnforceUniqueValues='FALSE'
MaxLength='255' StaticName='FirstName' Name='FirstName' />"
#column2 schema xml
$lastNameColXml = "<Field Type='Text' DisplayName='LastName' Required='FALSE' EnforceUniqueValues='FALSE'
MaxLength='255' StaticName='LastName' Name='LastName' />"
#build the list url
$listUrl = $myTestWeb.ServerRelativeUrl + "/lists/" + $ListName;
#we can't use getlist here as the method raises filenotfoundexception if the list url is not there
$myCustomList = $myTestWeb.Lists[$ListName]
if($myCustomList -eq $null)
{
  $lstId = $myTestWeb.Lists.Add($ListName,$ListDescription,$listTemplate)
  $myCustomList = $myTestWeb.GetList($listUrl) # use getlist here as  the list already exists
#Add columns
$myCustomList.Fields.AddFieldAsXml($firstNameColXml,$true,
[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
$myCustomList.Fields.AddFieldAsXml($lastNameColXml,$true,
[Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)
 $myCustomList.Update()
 write-host "list created successfully" $ListName
}
else
{
  write-host "List already exists" $ListName
}
}
catch
{
  write-host "Error" $_.exception
  $errorlabel = $true
}
finally
{
  if($myTestWeb -ne $null)
 {$myTestWeb.Dispose()}
  if($errorlabel -eq $true){exit 1}
  else {exit 0}
}exit 0

Add Column to a list
$site = SPSite($workspaceUrl)
$web = $site.RootWeb
$spList = $web.Lists["YourList"]
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("YourColumn",$spFieldType,$false)
$spList.Update()

Tuesday, September 4, 2012

Find right W3WP to debug


Identify Worker Process in IIS 7.0

From IIS 7.0 you need you to run IIS Command Tool ( appcmd ) .
• Start > Run > Cmd
• Go To Windows > System32 > Inetsrv• Run appcmd list wp


Copy DDL from GAC

Open “%windir%\assembly\GAC_MSIL”.
Browse to your DLL folder into the deep to find your DLL.
Copy the DLL somewhere on your hard disk