CoreResultsWebPart managed properties search RRS feed

  • Question

  • Hi,

    I have a document library with a Managed Metadata field and I am trying to develope a Search Webpart that searches this field.

    Basiclly what I am trying to do (unsuccessfully) is to Create a Webpart that inherits from CoreResultsWebPart that gets a Label as the UserQuery (from the url param 'k') and preforms a search through the Managed Propery (which is mapped to the field).

    I assumed that whatever resides in the UserQuery prop is than injected into the FullTextQuery as the value os Freetext oprator. but I am not sure about it anymore... could you clear that up for me?

    If it is so how can I change the FullTextQuery not to use 'Freetext' and to search by my Managed Property? If not, how do you suggest I develope this webpart? I have read about using SearchResultsHiddenObject but none of it seems to work now that is Obsolete in MOSS 2010...

    I hope I explained my problem clear enough for you to help me.


    Wednesday, June 16, 2010 4:16 PM


  • Hi,

     This links has complet details as required: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/05/13/wildcard-search-web-part-for-sharepoint-2010.aspx

    <Taken from the above link to refer:::>

    - We start by adding assembly references to Microsoft.Office.Server.Search. 

    - Then we create a new web part inheriting from CoreResultsWebPart and add the following using statements.

              using Microsoft.Office.Server.Search.Query;
             using Microsoft.Office.Server.Search.WebControls;
    -We then override the GetXPathNavigator method and get a reference to the QueryManager and override the UserQuery property.  In reality, there are only two lines of code involved.
            QueryManager queryManager = SharedQueryManager.GetInstance(this.Page).QueryManager;
            queryManager.UserQuery = string.Format("{0}", queryManager.UserQuery);

    Note: As per your requirement, try the above line as  given below (Replace the managedpropertyname with the your custom one. I havent tried, but seems it should work.)

            queryManager.UserQuery = string.Format("ManagedPropertyName:{0}", queryManager.UserQuery);
    Share your results.
    Friday, June 18, 2010 1:43 AM