none
Could not load type 'Microsoft.SharePoint.Search.Query.KeywordQuery' from assembly 'Microsoft.SharePoint.Search RRS feed

  • Question

  • Hi,

        I create a web application in 4.0 with vs2010 and i want to use KeywordQuery class to search the results from Fast Search which in core search results i have get my results what i want with taping anything keyword in searchbox .

       I have add references including Microsoft.Office.Server;Microsoft.Office.Server.Search;Microsoft.Sharepoint;Microsoft.Sharepoint.Search added by 

    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI;

       The code look like this:

       

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.SharePoint.Search.Query;
    using Microsoft.SharePoint;
    
    
    namespace SearchResult
    {
        public partial class ExcelReport : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                string s = "asdf";
                SPSite site = new SPSite("http://sh-sharepoint:9002/");
                KeywordQuery kRequest = new KeywordQuery(site);
                string strQuery = "111";//Keyword,which is same as the searchbox
                kRequest.QueryText = strQuery;
               
                //Write ,SiteName ,CollapsingStatus ,HitHighlightedSummary ,HitHighlightedProperties ,ContentClass, IsDocument,PictureThumbnailURL
               
                kRequest.SelectProperties.Add("Title");
                kRequest.SelectProperties.Add("Author");
                kRequest.SelectProperties.Add("Path");
                kRequest.ResultTypes = ResultType.RelevantResults;
               //........
            }
        }
    }
    

    It Build well.

    But when i run the project or debug it ,it throws errors:

    Could not load type 'Microsoft.SharePoint.Search.Query.KeywordQuery' from assembly 'Microsoft.SharePoint.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

     

    What's wrong with these codes?

     

    By the way ,there is something strange here ,in my GAC C:\Windows\assembly

    I have two Microsoft.sharepoint.search

    does it in right way?

    Please help me,thank you.


    In God We Trust
    Thursday, January 12, 2012 2:48 AM

Answers