Saturday, April 28, 2012

FAST Search 2010 on Taxonomy

Recently during my work, I got to build the query string for FAST Search 2010 for SP 2010. The refiner was the managed metadata column.
When we compare the enterprise search  result query string and FAST search query string, we see that FAST search has alphanumeric string after the "r" parameter.
Enterprise search has string as : r=%22owstaxIdColName%22%3D%230b37b7b2%2D0079%2D402b%2D8342%2D3aac932037ec%3A%22EMEA%22, which is : r="owstaxIdColName"=#0b37b7b2-0079-402b-8342-3aac932037ec:"EMEA".
While when same query string come as : r=%22owstaxIdColName%22%3D
AQRFTUVBCG93c3RheGlkABgDXiJvd3N0YXhpZFRlc3RUYWcjMGIzN2I3YjItMDA3OS00MDJiLTgzNDItM2FhYzkzMjAzN2VjIiQ%3D in FAST Search 2010 for SP.
Now challenge is how to build the query string in FSAT search. For this I referred the referenced articles and got a lot of ideas from Mikael.
I downloaded the attached refinementtokenencoder.cs. In the code, there is a refinement class.When you pass the existing alphanumeric string, you will get the components in the string as.
refinement.ManagedPropertyName.
refinement.RefinementName.
refinement.RefinementValue.
Since you know what was selected refiner, and you got the components of string. Now you pass your own components and use RefinementTokenEncoder.GenerateToken(refinement) to get the base64 string for FAST Search 2010.
I have tried this and worked perfectly for one refinement.it is easier than writting long FQL query and customizing core search web part to enable FQL for managed metadata column.

This can help when we have associated taxonomy with documents and just want to filter the documents associated with taxonomy. No need to enter any search keyword also.

I will put next blog on multiple refinement.

Reference:
http://msdn.microsoft.com/en-us/library/ff625182.aspx
http://techmikael.blogspot.in/2011/08/creating-refinement-query-parameter-for.html