Using SharePoint Search and Refiner Web Parts to Create a Custom Search Page

christineAdministrator Guides, SharePoint1 Comment

Here’s an example of a custom search page this one has pre-filtered results (documents and pages where the column “Document Type” is “Training” or “Reference” tenant-wide) in a Search web part and a Refiner web part on the right. You can do a very similar display using a people search with profile property values used as refiners (to filter staff by skills, schools, previous companies, etc).

sharepoint-custom-refiners

 

Annnnd second half of the screenshot, sorry I’m too lazy to glue them together properly:
sharepoint-custom-refiners

How to configure your search web parts

This post assumes you’ve already made the properties you want to use as refiners “refinable”. The pillars of a custom search page are the the following web parts, all from the “search” category in the web part gallery:

search-web-parts

Add them to your page (need a decent-looking page layout? Here’s the one used in the screenshot) and configure your search query. For the search queries, I like to start in the basic editor from the dropdowns, then switch to advanced to customize. Displaying “people” results? See this post if you notice people missing from results. Need to filter out service and test accounts from people results? Consider adding an employee-type property to your profiles, then add that limiter to your search query. As

Next, add the refiner web part to your page, go into the web part settings, and click “choose refiners.” Select the refinable properties you configured in the previous post and add them to the refiner list. Make sure to set a display name for the refiners in the settings, because RefinableString23 means nothing to users. I also like to set the max number of refiners displayed to more than I think I’ll ever have – this is the total number displayed, not the number shown before it adds the “show more” link. You can choose to sort the refiners alphabetically at this point as well if you like. Click OK when you’re done. If a full crawl has completed since setting up your refinable properties, and if you have data linked to those properties for the results displayed, you should see your refiners show up.

refiner-config

refiners2

If you have refiners that are long words or multiple words, you may notice that the text cuts off at a certain width. You can add this snippet to your page in a hidden Content Editor web part (under the source view) to widen it if you want:

<style>

.ms-ref-refiner #Value, .ms-ref-unsel-toggle, #OtherValue, #SubmitValue {
width:300px !important;
}

</style>

At this point you can add a search box as well if you like. It links to your search results web part on the page by default, no configuration needed.

That’s it! You now have a search page displaying results of your choosing that is filterable by the values in your libraries or profiles.

One Comment on ““Using SharePoint Search and Refiner Web Parts to Create a Custom Search Page”

Leave a Reply

Your email address will not be published. Required fields are marked *