Subscribe via RSS Feed Connect with me on LinkedIn

Custom Refinement Filters in SharePoint 2010 Overview

[ 12 ] October 13, 2010 |

Custom refinement filters allow us the ability to map a range of values from managed properties stored within the SharePoint search engine and then show these to our users in the refinement panel.

This really allows us to create our own categorizations of refinement options which can be applied to various values. There are two refinement types that we can create using the refinement panel:

  • Value Mapping: This can be a set of values that are to be matched. For example we can have certain Continents that include a countries. Then we can create filters that contain multiple countries linked to continents. In the Refinement Panel a user can click on Europe and get a set of results that includes Germany, France, England and other European Countries
  • Range Value: A range value can be applied to metadata that are either Dates, Numerics or Strings. This allows you to create categorization that finds items that fall into a specific range. For example lets assume that we have projects with different budgets, we can create a range refiner that will find items that fall into these budget bounds for instance.

The custom filter XML is the following:

  <CustomFilter CustomValue="string">

To see the full set of options then check out the MSDN post located here. However here are some tricks that I have picked up when working with the Custom Filter XML.


This is pretty simple, its either Range or Value. If you want to use a range (mostly numbers or dates) then use the RangeMapping option. If you want to use a series of options (for example Managed Metadata options) then use the Value Mapping.


This is the type of data that you are using. If using Dates then use Date, if using numbers then use numeric, if using strings (this includes Managed Metadata) then using String.


This is really useful for dates and can be used both for set dates and absolute dates. For instance if we want to create a RangeMapping that will find results back from yesterday, last week and last month we would use the following XML:

<CustomFilters MappingType="RangeMapping" DataType="Date" ValueReference="Relative" ShowAllInMore="False">
  <CustomFilter CustomValue="Last 24 hours">
   <CustomFilter CustomValue="Last Week">

So that’s all good, but what about if we want a specific date? For example lets see some results from the last calendar year, between 1 and 5 years ago and just this year?

<CustomFilters MappingType="RangeMapping" DataType="Date" ValueReference="Absolute" ShowAllInMore="False">
  <CustomFilter CustomValue="Last Calendar Year">
  <CustomFilter CustomValue="One and Five Calendar Years Ago">
  <CustomFilter CustomValue="This year">


You see what we did there? By specifying the ValueReference as absolute we now can insert set dates that will allow us to create this distinct date range, very cool indeed!


Your custom value is what will be displayed to users in the actual refinement panel. So in the example above the user will see three options ( Last Calendar Year, One and Five Calendar Years Ago, and This Year ) displayed in the refinement panel


When specifying a refiner you use the <OriginalValue> XML tag to define the value that you want to map to there are options in terns of  :

<CustomFilters MappingType="RangeMapping" DataType="Numeric" ValueReference="Absolute" ShowAllInMore="False">
  <CustomFilter CustomValue="Bronze Projects">
  <CustomFilter CustomValue="Silver Project">
  <CustomFilter CustomValue="Gold Projects">


This piece of XML indicates that if we refine on Bronze Projects we will get all values less that 50000, if we refine on Silver Projects we will get all results that fall in between 50000 and less than 50000, and if we refine on Gold we get all results that are greater than 500000.

So when specifying a value to filter on you have the following three options:

  • InclusiveValue..ExclusiveValue ( 1..50 will return all values in between 1 but less than 50)
  • ..Value ( ..50 will return all values less than or equal to 50)
  • Value.. ( 50.. will return all values greater than 50)

So that’s a brief overview, stay tuned to part two where we will create a refiner for a RangeMapping that will allow us to use both Absolute and Relative Dates in the actual refinements.

More Links

Need more information about the refinement panel, try these links:

Tags: , ,

Category: How To

About Michal Pisarek: Michal Pisarek is the founder of Dynamic Owl Consulting and a Microsoft SharePoint MVP. View author profile.

Comments (12)

Trackback URL | Comments RSS Feed

  1. […] This post was mentioned on Twitter by Glyn Clough, Michal Pisarek. Michal Pisarek said: Just Blogged: Custom Refinement Filters in SharePoint 2010 Overview […]

  2. SHpal says:

    Shame that Valuemapping is only supported for SharePoint Server search, thus not applicable for FAST for Sharepoint..

  3. Madhu says:

    Same issue as SHpal, we are using FAST with SharePoint and want to edit the “Site” refiner to show custom values but cant do it. :-(

  4. Hans Worst says:

    Check my blog for how to add icons to the refinement panel.

  5. Leonardo says:

    I can’t shown my refinement panel decimal value. how to show my refinement for demical managed property value.
    this my XML Code.



    How can l solve this problem.

  6. Les says:

    I am crawling a BDC list and so when it came to decimal values I converted them to integers (multiplying them by a value to make sure I didn’t lose any number, then used a custom filter with no decimal values in it. However the user thought that there was. Had to make changes to the search result too but that was no problem.

  7. Chris Quick says:

    Have you attempted to do a date range, i.e. I need items last updated less than 30 days ago then 30-60 days, 60-90 days, 90-180 days and over 180 days? Would love to see a sample… I tried something similar to the following using a RangeMapping/Relative -30.., -30..-60, -60..-90 but it doesn’t work as expected. If I reverse them, I get an exception (i.e. -90..-60).

    Thanks for any tips!

  8. […] you want more details on custom refiners, check out Michal Prisarek’s Custom Refinement Filters in SharePoint 2010 Overview. This is a great overview of custom refiners and was one of my jumping off points for this project. […]

  9. Chris Quick says:

    Figured it out — here’s the solution for a Relative Range for dates:

  10. Chalky says:

    What if original value is a null? How to specify null in the XML?

    Note that using the ‘null equivalent value’ in SP Designer doesn’t help – that seems to be intended for casting the other way (i.e. what value is to be treated as null).

  11. Great article, very handy.

Leave a Reply

If you want a picture to show with your comment, go get a Gravatar.