I cannot seem to get a custom keyword query to return phonetic results when searching for people.
I have FAST search installed, and if I do a people search (in the FAST search center) for "Jon", I get the expected results containing both "Jon" and "John". However, if I construct a keyword query (as shown below) I only return the results for "Jon".
Any suggestions?
using (SPSite spSite = new SPSite("http://localhost"))
{
// get the query and settings service proxy
SearchQueryAndSiteSettingsServiceProxy settingsProxy = spSite.WebApplication.Farm.ServiceProxies.GetValue<SearchQueryAndSiteSettingsServiceProxy>();
// get the search service application proxy by name
SearchServiceApplicationProxy proxy = settingsProxy.ApplicationProxies.GetValue<SearchServiceApplicationProxy>("FAST Query SSA");
KeywordQuery keywordQuery = new KeywordQuery(proxy);
keywordQuery.RowLimit = 100;
keywordQuery.EnablePhonetic = true;
keywordQuery.EnableNicknames = true;
keywordQuery.ResultsProvider = SearchProvider.SharepointSearch;
keywordQuery.ResultTypes = ResultType.RelevantResults;
keywordQuery.SelectProperties.Add("firstname");
keywordQuery.SelectProperties.Add("lastname");
keywordQuery.QueryText = "jon";
ResultTableCollection fullTextSearchResults = keywordQuery.Execute();
if (fullTextSearchResults.Exists(ResultType.RelevantResults))
{
ResultTable searchResult = fullTextSearchResults[ResultType.RelevantResults];
Console.WriteLine("Total Rows: " + searchResult.TotalRows) ;
Console.WriteLine("Total Row Count: " + searchResult.RowCount);
Console.WriteLine("Total Rows Including Duplicates: " + searchResult.TotalRowsIncludingDuplicates);
Console.WriteLine("Is Total Rows Exact: " + searchResult.IsTotalRowsExact);
}
}