SHAREPOINTSearch.com

Welcome to SHAREPOINTSearch.com Sign in | Join

in Search
Skip Navigation Links
Home
Resource CenterExpand Resource Center
Research CenterExpand Research Center
BIG Resource List
Blog Zone
Forums
RequestsExpand Requests
About Us

apostrophe's not behaving in search results

Last post 11-12-2008 5:38 PM by ore. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 11-12-2008 5:38 PM

    • ore
    • Top 100 Contributor
    • Joined on 11-12-2008
    • Posts 1

    apostrophe's not behaving in search results

    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

Page 1 of 1 (1 items)
SHAREPOINTSearch.com is not affiliated with or endorsed by the Microsoft Corporation.See our Terms, Conditions and Privacy Statements
SharePoint is a trademark of the Microsoft Corporation.