So I’ve spent some time playing with setting up search driven applications recently. One of the things I’ve noticed is that the SharePoint Refiner Panel WebPart is a great tool for narrowing down search items based on the refiners that are available. I love the way the Site and Result Type refiners will show the number of documents. However, there are times when OOB the refiners don’t seem to show document counts; Or times wen document counts aren’t as useful and we’d like to use percentages instead. With some quick changes to the XML we can add additional functionality to the Categories in the Filter Category Definition.
Here is the basic Template for Categories:
<Category
Title="string"
Description="string"
Type="TypeName"
MappedProperty="PropertyName"
MetadataThreshhold="value"
NumberOfFiltersToDisplay="value"
MaxNumberOfFilters="value"
SortBy="Frequency|NumericValue|Name|Custom"
SortDirection="Descending|Ascending"
SortByForMoreFilters="Frequency|NumericValue|Name|Custom"
SortDirectionForMoreFilters="Descending|Ascending"
ShowMoreLink="True|False"
MoreLinkText="string"
LessLinkText="string"
ShowCounts="Count|Percentage">
… </Category>
The trick is to edit the results page you want to customize, and select Edit Web Part on the Refinement Panel. Under refinement is the “Filter Category Definition” field, you’ll want to click the more button in order to bring up the whole thing:
Generally I like to take the results, cut and past into a decent XML editor and then update the XML from there. A complete definition can be found here.
So in my case, I wanted to show percentages for the “Modified Date” refiners. I changed the ShowCounts attribute to ”Percentage” as a value, and now I have percentages in my refiners:
Not only are you displaying percentages, but if you do this with various refiners it will also give a great visual when people are searching about which systems/URLs ratios have the most data.