none
Redirect search result to a SharePoint site RRS feed

  • Question

  • Hi everybody,

    I would know if possible in SharePoint Search to redirect result to a existing site ?

    Here is the context:

    I have many SharePoint sites which the title is: ER 1300-01, ER 1300-02, ER 1300-03, etc...

    My need is when someone make a search for example with the word ER 1300-01, it redirects to the site which the title is "ER 1300-01", I don't want results page in this case.

    If possible, please give me details how do that.

    Thanks.

    Wednesday, November 13, 2013 9:45 AM

Answers

All replies

  • hi

    easiest way.

    create a separate list ( sites_list )somewhere in your farm with all your site collection ( to avoid to code in your custom aspx. page )

    create a separate custom page, insert there a content web part and there show sites_list  items

    In that page add acode when the user select one of that item , to open that site


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, November 13, 2013 9:51 AM
  • Hi Romeo,

    Thanks for your response, but my need is for SharePoint Search. When the user type in search box control ER 1300-01, I want that it redirects to the site that have the title ER 1300-01.

    At present, the search redirects me to results page, with the link to that site. I would know if i can avoid to pass by results page in some cases like this. (It's not a problem if I have to do some codes).

    Thanks.



    • Edited by rmanga7 Wednesday, November 13, 2013 10:41 AM
    Wednesday, November 13, 2013 10:21 AM
  • Hi,

    According to your description, my understanding is that you want to redirect the search result page to a SharePoint site based on the query text filled in the search box.

    Per my knowledge, there is no OOTB way to achieve what you want. I recommend to write code to meet the need: 

        1.  Get the first result item of the Search result with result type SharePoint Site only

            You can either:

         a. Create a new Search Result web part which show only SharePoint Site Result Type. Retrieve the link of the first result item.

    <a title="test-80" class="ms-srch-item-link" id="ctl00_ctl40_g_dab7464c_6e6b_4061_9498_72d3f76c117c_csr26_item_itemTitleLink" onfocus="EnsureScriptParams('SearchUI.js', 'HP.Show', 'ctl00_ctl40_g_dab7464c_6e6b_4061_9498_72d3f76c117c_csr26_item', 'ctl00_ctl40_g_dab7464c_6e6b_4061_9498_72d3f76c117c_csr26_hover', '~sitecollection\u002f_catalogs\u002fmasterpage\u002fDisplay Templates\u002fSearch\u002fItem_Site_HoverPanel.js', false);" href="http://server" clicktype="Result"><strong class="ms-srch-item-highlightedText">test</strong>-80</a>

        b. Get the first query result item returned by Query Search with the JavaScript Client Object Model.

    http://code.msdn.microsoft.com/office/SharePoint-2013-Querying-a629b53b

        c. Or another ways you can image that the link can be got.

        2. Check whether the result item title matches the search keywords. It will help to eliminate un-intended scenarios that when you search other keywords than ER XXXX-XX the result page redirects you to a SharePoint site shown in the result.

        3. Add a Content Editor web part in the search result page.

        4. Pass the URL to Content Editor web part and then use the code below in the Content Editor web part to redirect the page to the site:

    <meta http-equiv="refresh" content="5;url=page url">

    Best regards.

    Thanks


    Victoria Xia
    TechNet Community Support

    Thursday, November 14, 2013 1:20 PM
    Moderator
  • Thanks for your response,

    Finally I developed the following solution:

    I overrided the SearchBoxScriptWebPart control using a custom result page ( http://www.estruyf.be/blog/replacing-the-ootb-small-search-input-box-for-sharepoint-2013/ ).

    I added a code behind to that result page, and i have done the process in that:

     - retrieve the search text from QueryString

     - check if the search text meet the pattern (ER xxxx - xxxx)

     - if Yes, do a SPUtility.Redirect to redirect to the good site, else go to the result page.

    Thanks.

    Monday, November 18, 2013 10:04 AM