Friday, July 12, 2013

Enabling multi-select refiners in SharePoint 2013/Office365

I recently received a question about how to do multi-select refiners in SharePoint 2013 as comment on my post Limiting Search Results in SharePoint.

Fortunately this is very easy, which is was not in SharePoint 2010.

  1. On your search page, edit the Refinement web part
  2. Click the “Choose Refiners” button
  3. Select your refiner, eg. FileType
  4. Chose the “Multi-value Refinement Item” display template
  5. Click OK and Save the web part changes

image

Your Result type refiner will now look like the image below where you can check off each value you want to refine on.

imageimage

You should note that when using this template it will in the case of file types show the extension and not the application names which is does with the “Refinement Item” display template. But that’s fixable if you edit your display templates :) and left as an option for you.

4 comments:

  1. Great post - just what I was looking for!

    Now I'm wondering whether I can somehow make it so that the refinement results come from an AND statement instead of OR for the checked values...

    Any suggestions would be a great help!

    Thanks!

    ReplyDelete
    Replies
    1. Hi,
      If you url decode the Default parameter after you check two values it will look something like this:

      {"k":"*","r":[{"n":"FileType","t":["\"ǂǂ68746d6c\"","\"ǂǂ786c7378\""],"o":"OR","k":false,"m":{"\"ǂǂ68746d6c\"":"html","\"ǂǂ786c7378\"":"xlsx"}}]}

      Replace OR with AND and you get what you want. It's all a matter of changing how the query is being built in the display template. Might be a js function, but I haven't explored it. At least it seems possible to do it, as long as you figure out how to build the json query.

      Delete
  2. Hi,
    Is that possible for us to restrict the search result based on a column in document library, for example I have a column called document type I want the search result only from that document library and also based on the value from document type.

    Thanks in advance.

    ReplyDelete
    Replies
    1. If you map the crawled property of the column to a managed property, or use the automaticlly created mp if it's a site column, then limit on both the "path" of the list and the value of the columns managed property.

      Delete