Hi All,
Hoping some one can help me here. I'm working on an intranet site and the people search is not returning back people if they have an apostrophe in their name. It is a wild card search. As far as I know all users are pulled in via active directory. Not sure as of yet how they are stored or listed through sharepoint.
Searching the following yeilds the following results.
"Katy" => Katy Sullivan, Katy O'Sullivan
"Katy S" => Katy Sullivan
But...
"Katy O" => ........... nothing
As soon as it needs to match on the second name with the apostrope it fails.
Code:
// Create the fulltext query ...
ResultTable results = null;using (FullTextSqlQuery query = new FullTextSqlQuery(ServerContext.Current))
{
StringBuilder queryBuilder = new StringBuilder();queryBuilder.AppendFormat("Select {0} ", SearchProperties.GetPropertiesAsQuery());
queryBuilder.AppendFormat(
"From scope() Where \"scope\"='People' {0} Order By LastName Asc, FirstName Asc", this.GetQueryKeywords());
//queryBuilder.AppendFormat("From scope() Where \"scope\"='People' AND FREETEXT(DEFAULTPROPERTIES,'\"{0}\"') Order By LastName Asc, FirstName Asc", this._keyword);
// authentication, and try / catch
query.QueryText = queryBuilder.ToString();
query.ResultTypes = ResultType.RelevantResults;
query.RowLimit = 2000;
//query.EnableStemming = true;
//query.IgnoreAllNoiseQuery = true;
//query.StartRow = startIndex;query.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery;
query.TrimDuplicates =
true;query.KeywordInclusion = KeywordInclusion.AnyKeyword;
query.SiteContext =
new Uri(_site.Url);
// query for the results ...ResultTableCollection resultCollection = query.Execute();
_queryTime = resultCollection.ElapsedTime;
results = resultCollection[ResultType.RelevantResults];
}
return results;
Query that gets built:
"Select WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL, FirstName, LastName, PictureURL, Position, Team, Department, OfficeNumber, Extension, WorkPhone, MobilePhone, WorkEmail, AboutMePers, AboutMePro, Fax, Pager, Address From scope() Where \"scope\"='People' and contains('\"katy o*\"') Order By LastName Asc, FirstName Asc"
Same query for Katy S except that "contains('\"katy s*\"')" contains the different query.
results contains nothing for katy o where it should have 1 record.
Any help would be appreciated.
cheers
mike