Send This Site query to Search Center RRS feed

  • Question

  • The main issue here is that when a user searches  ThisSite, their results are shown up in osssearchresults.aspx

    This page does not have the branding of the portal that it belongs to.

    If I send the query to the Search Center (separate site collection) then the query loses its context and just shows results for Everything.

    How do I allow a user to Search This Site and have their results show up in the Search Center? Or another way might be to somehow pass the url of the site to the Search Center.

    Thursday, May 11, 2017 1:51 PM

All replies

  • Hi Sonners,

    There is no OOB way to pass the current site url into the Search center.

    For your requirement, as a workaround, you can create a page in the site and add the related search web parts into the page and design it like the search center results page, then send the query to the custom results page.



    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    • Proposed as answer by Victoria Xia Wednesday, May 24, 2017 8:07 AM
    Friday, May 12, 2017 7:34 AM
  • If you look at the URL when searching "this site" you will see two query parameters: "u" and "k"

    osssearchresults.aspx?u=<full web URL>&k=<query text>

    You can pass these same params to the Search Center's results pages and it will filter results to that site -- specifically the "u" param.

    The downside to this approach is that there is no indication on the page that results are being filtered, and there is no way to remove the filter or switch to "Everything" without changing the URL. In fact, the filter is kept even when selecting, e.g., People.

    You'd have to put some work towards perhaps customizing the search box's display template to control when the filter is used again or give the user a way to remove it. That may be significantly less work than e.g., customizing and maintaining a new search results page on every site collection.

    • Edited by B DiMaggio Thursday, June 28, 2018 1:11 PM
    • Proposed as answer by B DiMaggio Thursday, June 28, 2018 1:11 PM
    Thursday, June 28, 2018 1:07 PM