Monday, January 5, 2015

Date Slider Refiner (slider with bar graph) Not Working for a Custom Managed Date Property!

I am assuming if you are reading this article you have hit the frustrating wall of your custom date refiner showing the graph and slider incorrectly.  The refiner looks correct until you actually use the refiner and realize that range is numeric instead of last year, six months, etc!

Well if you are looking for a fix you are in the right spot friend.  The refiner is not working correctly due to your managed property name!  Believe it or not the managed property name will impact the date slider refiner.

For this example I have created a new managed property of date type called date_Published which has an associated crawled property and all of the correct settings.  When I modify my refinement panel and add date_Published as a refiner using the slider with bar graph, it looks correct but the values are all numeric integers!

After a great deal of sleuthing I realized that if you append on two numbers to the end of your managed property between 0 – 9 the property will render correctly, aka managed_PropName[0-9][0-9].  When I updated my managed property to the name date_Published85 the refiner rendered correctly!

Final Results


Hope This Helps!

Dan

Friday, January 2, 2015

How to Add Totals to Search Refiners in SharePoint 2013

So for every Search project I work on this requirement always surfaces, which is why I am confused to why Microsoft did not default the refiners to include the totals.  Including totals in your refiners is actually very easy and only requires a small modification to your Search Filter refiner.  Depending on whether you are utilizing a single option refiner or the multi value refiner will determine which filter refiner you will need to update.


Single Selection
              Filter_Default
Multiple Selections
             
Filter_MultiValue
The first step to modifying the refiner(s) is to locate them

How to Locate Your Filter Files:
(Note: We do not want to modify the JS Files, any updates we make to the HTML files will propagate to the linked JS files.)

  1.   Site Settings
  2.  Master pages and page layouts
  3.  Display Templates
  4.   Filters
  5. Save a copy of either the Filter_Default.html and/or Filter_MultiValue.html files to your desktop
How to Modify Your Filter Display Templates
Now that we have saved copies of the filter display templates, it is time to edit them in order to display totals.

  1. Open the files in a text editor i.e. Notepad++, Notepad, SharePoint Designer, Visual Studio, etc 
  2. Modify ShowCounts: to equal true
Original

<!--#_
 
    this.Options = {
        ShowClientPeoplePicker: false,
        ShowCounts: false
    };
Updated
<!--#_
 
    this.Options = {
        ShowClientPeoplePicker: false,
        ShowCounts: true
    };

After making the update from false to true you will need to upload the new file and publish the changes.  By using the exact same file name your changes should be saved as a new version to the file, if you were not modifying it directly.

Best Of Luck!
Dan