Saturday, July 13, 2013

SharePoint 2013 Search: Cascading Refinements of Multi-Value Properties

My cascading refinement solution builds upon the instant refinement solution described in my previous post. The modifications update the result counts in other multi-refinement property sections as well as disables the filters that are no longer available because of the initial refinement.

This post describes a high level overview of the steps necessary for the cascading refinement functionality. You may find the code and more detailed steps in my new Enhancing the Search Experience in SharePoint 2013 guide book.

Step 1: Store the Property Selected First

Since the cascading is based on the property that is refined first, you must store the property.

Step 2: Evaluate the List Data and Modify Accordingly

At the top of the file, create a new array to store and process the list data and previous refiners. Add logic to set the list data to the previous refiners.

Step 3: Determine if Filter is Still Available and Update the Refinement Count

Within the !hasNoListData condition block, change the refiners.push logic.

Step 4: Flag Filters that Should Be Disabled

Flagging the filters that should be disabled involves two modifications. The first is to add logic to the hasFilterTokens condition. The second portion involves adding an else condition to the hasFIlterTokens if statement.

Step 5: Save Changes to the Template File

Step 6: Modify the Body Display Template

Within the for-loop, create an isDisabled variable and a fontWeight variable.
In the isSelected if statement, add fontweight=”bold”; :
Branch the else statement to check for isDisabled.

For the disabled version, just copy the input for the unselected check box but add the disabled=”disabled” property.

Finally in the label, add the a style property using the fontWeight variable.

Save the changes to the body file.

Step 7: Test the Cascade Functionality

Navigate to the search results page that contains the multi value refinements:

Click on one of the filters.



SharePoint 2013 Search: Instant Refinement of Multi-Value Properties - No Need to Apply

When you configure a refinement as multi-value, the user is presented with the list of available filters with checkboxes:

The user must select one or more checkboxes and then click on the Apply link. After they click on the Apply link, the results are refined by the selected filters but only the selected filters are presented:

With my Instant Refinement solution, all filters are displayed all of the time and when the user clicks on a checkbox, the results are instantly refined without the need to click on an Apply link.
This post describes a high level overview of the steps necessary for the instant refinement functionality. You may find the code and more detailed steps in my new Enhancing the Search Experience in SharePoint 2013 guide book.
Modification Steps

Step 1: Modify or Copy the Multi Value Display Template

Using SharePoint Designer 2013, navigate to the Filters display templates. Copy or modify the Filter_MultiValue.html file. Edit the file in advanced mode.

Step 2: Store the Original Filters

At the bottom of the display template add code to store the original set of refiners in a property of the RefinementControl object.


Step 3: Retrieve the Original Refiners

At the top of the display template you need to create a new array to store the original filters. Along with this you need to add logic to retrieve the previous refiners if they exist.

Step 4: Remove Condition from theRefiners Collection Creation

Scroll down the !hasNoListData condition block and remove the !hasAnyFilterTokens && check from the condition inside.

Step 5: Change Filter Tokens Logic

Scroll down to the hasAnyFilterTokens condition block and replace the refiners.push statement with code that just sets the IsSelected property to true if the refiner has been checked by the user.

Step 6: Save the Template Changes


Step 7: Modify the Controls in the Body Template

Modify or copy the Filter_MultiValue_Body.html file. Edit the file in advanced mode. Scroll to the bottom and find the submit link. Copy the onclick property. Paste the onclick into the checkbox inputs. Remove the Other and Submit divs sections from the bottom. Save the changes to the body file.

Step 8: Test the Changes

Navigate to your search page that contains the multi value refinements and review the experience:


You may click on each checkbox and watch the results instantly refine while always displaying all possible filters!!!

I improved this even further by creating a cascading solution for when you have multiple multi-value refinements!




Monday, July 8, 2013

SharePoint 2013 SSRS: Access Denied Clicking System Settings

After installing SSRS in Integrated Mode with SharePoint 2013, you may find you receive an error when attempting to click on System Settings within the SSRS:

Before you can modify the System Settings of SSRS, you must first set the Execution Account:

Enter the Account and Password of the SSRS Service Account (make sure you also include the DOMAIN name):

After this is set correctly, you should be able to get into the System Settings!

Tuesday, July 2, 2013

SharePoint 2013 Search: Setting All Search Boxes to Use Your Search Center

Search boxes that appear on your sites and sub-sites will automatically render local results first and if you have the global search center set in your Search Service Application, a link appears to "expand your search" which then navigates to your search center.

You may configure the search boxes to navigate to your search center at both the site collection and site level. This is performed under Site Settings -> Site Collection Administration -> Search Settings for the site collection and Site Settings -> Search -> Search Settings for the site level. If you configure these settings at the site collection level, the same settings will be used for all sites within the site collection unless modified.

In setting up our new SharePoint 2013 farm, navigating through hundreds of site collections to modify these settings was not an option. Therefore I wrote a simple PowerShell script to loop through all site collections within a given web application and apply the search center URL and result page to them:

$SPWebApp = Get-SPWebApplication http://sp2013
foreach ($SPSite in $SPWebApp.Sites)
    if ($SPSite -ne $null)
        $web = Get-SPWeb $spsite.Url       
        $web.AllProperties["SRCH_SB_SET_SITE"] =  

        $web.AllProperties["SRCH_ENH_FTR_URL_SITE"] = '/sites/SearchCenter/Pages'



I found a post here that shows how to loop through each sub-site (SPWeb) and set the settings at the site level, however, I believe I have achieved my goal just by setting these values at the site collection level.


Matched Content