Introduction
This article shows you how to create a custom site collection search results page, with search facets, in five easy steps. You will be shown how to do this using nothing more than the standard web front end tools (page edit mode) and the out-of-the-box web parts that come with SharePoint Server 2010. Site Collection Administrator privileges will be needed to actually point site collection search to the new search results page, but the rest can be done with no more than standard Contributor permissions. Creating a custom search results page is remarkably easy, and this article shows you how.
There are a few assumptions to keep in mind, as you work through this article. The first is that the SharePoint Server Publishing Infrastructure feature has been activated for the target site collection. Second, it assumes that you have added content to your site collection, such as Office documents. Third, it assumes that Search has been successfully configured and that content has been indexed. Lastly, it assumes that a Search center has not been configured and that site collection search results are still being presented in the default search results page. One more thing: in developing this article, I performed the testing against a special corpus of content that I created that has been seeded with keywords designed to return known results.
Step 1: Add a new page
- Navigate to the top site of the site collection.
- From the Site Actions dropdown, select More Options.
- Select Page, from the Filter By group, at left, and then select Web Part Page.
- Click Create.
- Enter a name for the new page. For this article, MyCustomSearchResults was used.
- Select the Layout Template. For this article, the Header, Left Column, Body template was used.
- Then select the document library where you want to page to be stored. For this article, the Site Pages library was used. You could also use the Site Collection Documents library.
- Click Create. The new web part page is created, and your browser is navigated to the page in edit mode.
- On the Page ribbon, click the Stop Editing button. The page is refreshed, and now appears in normal mode.
Step 2: Add basic search results capability
- In the Body web part zone, click Add a Web Part. A new section appears on the web page, from which you can select web parts.
- In the Categories section, scroll down and select Search; then, in the Web Parts section, use the arrow links to browse the search web parts for Search Core Results, and then select this web part.
- Click the Add button. The page is refreshed to show the new web part in the Body web part zone.
- On the Page ribbon, click the Stop Editing button. The page is refreshed, and now appears in normal mode.
Step 3: Configure the Site Collection Search to use the custom page
- From the Site Actions dropdown, select Site Settings.
- In the Site Collection Administration group, click Search Settings. The browser is navigated to the Search Settings page.
- In the Site Collection Search Results Page field, enter the path and filename to your new custom search results page. For this article, the path and filename would be: /SitePages/MyCustomSearchresults.aspx. Leave all other settings at their default values.
- Click OK. Now to test the results against the test content.
- The first test will use the keyword document010, which should return just three results: one each of Word, PowerPoint and Excel documents.
Performing the search returns the expected results.
So far so good.
- The second test will use the keyword Global010, which should return 30 results: 10 each of Word, PowerPoint and Excel documents. Performing the search does not return the expected results.
Step 4: Add Paging Capability
- With your browser still connected to the new custom search results page, on the ribbon, select the Page tab, and then click the Edit Page button. The page is refreshed to display it in edit mode.
- In the Body web part zone, click Add a Web Part. A new section appears on the web page, from which you can select web parts.
- In the Categories section, scroll down and select Search; then, in the Web Parts section, use the arrow links to browse the search web parts for Search Paging, and then select this web part.
- Click the Add button. The page is refreshed to show the new web part in the Body web part zone.
- Optional: by default, the new web part appears above the existing one. However, you can easily move it below, by simple drag-and-dropping methods. For this article, the Search Paging web part is moved to below the Search Core Results web part.
- On the Page ribbon, click the Stop Editing button. The page is refreshed, and now appears in normal mode. Now to test the results against the test content.
- The test will again use the keyword Global010, which should return 30 results: 10 each of Word, PowerPoint and Excel documents. Performing the search returns a list of 10 results, and paging tools now appear.
- The next step is to implement search facets.
Step 5: Add search facets
- With your browser still connected to the new custom search results page, on the ribbon, select the Page tab, and then click the Edit Page button. The page is refreshed to display it in edit mode.
- In the Left Column web part zone, click Add a Web Part. A new section appears on the web page, from which you can select web parts.
- In the Categories section, scroll down and select Search; then, in the Web Parts section, use the arrow links to browse the search web parts for Refinement Panel, and then select this web part.
- Click the Add button. The page is refreshed to show the new web part in the Left Column web part zone.
- While were at it, let's add one more useful search web part: the Search Statistics web part, which displays the number of results returned and how many you are currently viewing (given search paging). Add the web part using the same method as previously.
After you finish, you'll see two web parts displayed at left.
- On the Page ribbon, click the Stop Editing button. The page is refreshed, and now appears in normal mode. Now to test.
- The test will again use the keyword Global010, which should return 30 results: 10 each of Word, PowerPoint and Excel documents. Performing the search returns a list of 10 results, as expected.
The search facets display the default facets. Note that the Search Statistics web part discretely displays the number of currently viewed search results.
Summary
This article has shown you how to implement a custom site collection search results page in just five easy steps, and all without writing any code, nor even using SharePoint Designer for that matter. For additional details on the topics discussed in this article, consult the references below.
References