How to customize the SharePoint 2010 search query string parameters

Răspuns How to customize the SharePoint 2010 search query string parameters

  • 7 mai 2012 15:29
     
     

    Hi All,

    I am trying to redirect default SharePoint search to a custom search results page.

    I modified the Search Settings to redirect to the URL that I want.

    But my custom search page takes different query string parameters to provide the results.

    Eg: SharePoint search passes k=search term when we perform a search. But my custom page needs test=search term

    I would like to pass 'test' instead of 'k' as a query string. Is this possible?

    Thanks

    Carol


Toate mesajele

  • 7 mai 2012 20:09
     
     Răspuns
    The search results page contains a CoreResultsWebPart that will be used to display the search results. This web part is fixed to use the K parameter to perform searches. The CoreResultsWebPart can be extended using code. This will make it possible to read the test querystring parameter and override the search keyword query.

    SharePoint Developer | @zeemanj | Blog

  • 8 mai 2012 11:30
     
     

    I don't have an environment, but wouldn't it be quite possible to use a Query String filter webpart and connect that to the CoreResults webpart to achieve this?

    Technically you'll need to connect to a whole bunch of webparts on that page, but it *should* work...


    jliu - http://johnliu.net - http://sharepointgurus.net

  • 8 mai 2012 13:19
     
     Răspuns
    There is no way out of the box to change it.  You could always write your own control that passes the value or inherit from SearchBoxEx web part (if you are using a search center) to pass a different value.  Query String Filter web part won't help you here I am afraid.  However, wouldn't it be easier just to change your code to take the value that SharePoint passes you?

    Corey Roth - SharePoint Server MVP blog: www.dotnetmafia.com twitter: @coreyroth