Setting up Sharepoint search

RCDA Webmaster 281 Reputation points
2020-10-14T13:22:50.027+00:00

I have an office 365 SharePoint collection with many sub sites, one for each office in my company. I want to add a search box to one of my sub sites such that it returns results only for that office. I did some research and have found instructions for setting up the enterprise search center which wants me to create another sub site in my collection for searching which presents users the ability to search: everything, people, conversations and videos. While I'm not opposed to creating such a sub site, I want something that feels a bit more integrated and only returns search results within the current site and any sites below it in the collection. This way there could be a search box on the homepage and searching there would return results from the entire site. If I drill down to the Human Resources sub site and search using the search box on the home page of that site, I want only results from HR since the search was generated in that site and there are no sub sites. Additionally, I would like to have the results page be tied to the site that I searched from. What I'm thinking is adding a SearchResults.aspx page to each site and having the search box on each site point to the page in that site. Each of those pages can then be setup to return results from that site and any sub sites.

Is this possible or do I have to create a search center and use filtering to narrow down the results?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,296 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,141 Reputation points
    2020-10-15T07:15:49.95+00:00

    @ RCDAWebmaster-7259,

    All things real considered, we suggest you create a Search Center site and set query conditions to filter search results.

    For example:

    1.Create the Search Center site
    2.Go to the "results.aspx">> click Edit page under the Settings menu >> select Search Results web part, and then click Edit Web Part option >> on the Search Results panel, expand "Search Criteria" node, click "Change query" button
    3.On the Query panel, you could define the following query filter statement( Only return results for the current site without subsites):
    {SearchBoxQuery} Site:https://testlz.sharepoint.com/sites/Intern1/ - Site:https://testlz.sharepoint.com/sites/Intern1/subsite1/
    32519-filter.png

    The following figure is a screenshot of the comparison before and after setting:
    32520-s1.png

    There is a similar case for your reference: Restricting Search to Current Site Only.

    Thanks,

    Echo DU

    @ RCDAWebmaster-7259,

    ………………………………Updated Answer………………………………

    By design, SharePoint Server automatically adds the search box to the welcome homepage of each site, without requiring users to go to the master page for extra settings.

    After you creating the Search Center site ( http://sp/sites/search ) and a full crawl of the content source, then you could go to the home page of any one sites or site collections. When querying keywords in the search Input box located in the upper right corner of the page, the search Input box will return all results from the main site and subsites.

    You can refer to the below screenshots
    1)SharePoint site collection Hierarchy Structure
    33176-3.png

    2)Search Results
    33191-1.png
    33155-2.png

    Thanks,
    Echo Du

    ===============

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. RCDA Webmaster 281 Reputation points
    2020-10-15T13:36:05.327+00:00

    Your filtering is wrong. I want to show results from the site I searched from on my main site and any sub sites. I'm planning to add a search box to the welcome page of all my sites through the master page.

    I found out that the site has a search center /searchCenter. How do I add the global navigation menu bar?


  3. RCDA Webmaster 281 Reputation points
    2020-10-19T14:14:01.39+00:00

    The site has never had a search box on it. I finally figured out that in our alternative CSS file, someone, probably me, set the search box to not display using #SearchBox{ display:none}. This could be because we didn’t have the search feature on our 2010 on premises site which we migrated to the cloud. I think I was going to play with it after the new site was up and running, but never got back to it.

    After 2 years, a request came in to add a search box to the HR site since it’s rather large and is a bit overwhelming for users. I’ve now removed that bit of CSS and the search box has returned. It’s now on all the sites in the collection.

    I like that the search feature is setup to show instances of the search criteria in the site I searched within including any sub site. That is exactly what I was looking for. Knowing that results are set to only show if a user has access to the content is prefect. It’s as if MS knew what I wanted.

    Now all I need to do is figure out how to eliminate multiple links to the same documents in the results. Since I'm going to use the OOTB search box that is on each site in the collection, do I need to adjust the search results page (_layouts/15/osssearchresults.aspx) within each site to return only one instance of each item or can I do this in some global setting? Also, How do I know if multiple results for the same item is that item uploaded to the site multiple times or not?


  4. RCDA Webmaster 281 Reputation points
    2020-10-22T12:56:36.063+00:00

    Microsoft setup search to display duplicate results as the default? I can't see why. Since each site in my collection has a search results page so I'm now left with the painfully repetitive task of turning off duplicate results on 29 sites. Thanks Microsoft.

    Upon further review, I can't edit the page with the search results since it's in the layouts folder (_layouts/15/osssearchresults.aspx)

    what do I do now?


  5. RCDA Webmaster 281 Reputation points
    2020-10-22T17:23:20.677+00:00

    Now I need to create a new page for each site just do I can edit the search results?