Saturday, August 31, 2013

SharePoint 2013: How To Integrate BCS with Search


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

Introduction

This post discusses the overall process of incorporating external data into SharePoint 2013 Search by leveraging Business Data Connectivity Services (BCS). I have an end-to-end solution that integrates product data from a SQL Server database into SharePoint 2013 by using external content types. This is covered in my Search Walkthrough Guide as well as my Enhancing the Search Experience Guide. However, the detailed steps are also available on their own within my SharePoint 2013 Solution Series guides. (Sorting and refinement only appear in the larger).


Step 1: Prepare the Data Source

The first step is to create your read list and read item procedures.
  • Create a stored procedure that returns all of the information you want to search and make sure all rows are returned. 
  • Create a stored procedure that returns the same information but only for a particular entity by using the ID as a parameter.

Step 2: Add Credentials to the Secure Store Service

In order for the External Content Type to be created and BCS to access your external data source, the data source credentials need to be stored. The Secure Store Service in SharePoint allows you to store credentials. For my scenario, a SQL database account was created named “AWDBAccount”. Therefore an entry in the Secure Store Service needs to be added for SQL Authentication.

Step 3: Create an External Content Type

The methods I describe in my books provides the steps for a no-code solution in creating an External Content Type that uses your data source as the provider of information via SharePoint Designer 2013.


Step 4: Set Permissions on the BCS Entity

I can imagine that this is often an overlooked step. Once the External Content Type is created, you need to give permissions to it, otherwise the search account as well as users will not be able to access the data.

Step 5: Create a Content Source for the External Content Type

In order to crawl the external data, you need to create a content source in Search.

Step 6: Create Managed Properties

After the crawl has completed, you now need to create managed properties and map them to the crawled properties from the new content source. This may be accomplished from the Search Service Application UI or from PowerShell. I describe both methods in my guide books.

Step 7: Create a Result Source

Step 8: Create a Result Type

Step 9: Create a Custom Search Results Page

Step 10: Add the Custom Search Results Page to the Search Navigation

Step 11: Test the Results


The results won't look too pretty. The remaining steps involve creating custom search display templates to properly present the external data search results.

Step 12: Create a Display Template

Step 13: Create an Item Hover Panel

Step 14: Update the Result Type to use the Display Template

Step 15: Test the Overall Results


Conclusion

In just 15 simple steps you can integrate external data into SharePoint 2013 Search by using external content types and BCS. You can get the entire end-to-end solution steps in my guides or from my SharePoint 2013 Solution Series:


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

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.
 
GET ALL OF THE CODE AND DETAILED STEPS IN MY NEW SEARCH EXPERIENCE GUIDE:

 

SPECIAL LOW KINDLE PRICE!!!

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

Overview
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.

<!--[endif]-->

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!

GET ALL OF THE CODE AND DETAILED STEPS IN MY NEW SEARCH EXPERIENCE GUIDE:

 

SPECIAL LOW KINDLE PRICE!!!

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"] =  

                {"Inherit":false,"ResultsPageAddress":"/sites/SearchCenter/Pages/results.aspx","ShowNavigation":false}'
        $web.AllProperties["SRCH_ENH_FTR_URL_SITE"] = '/sites/SearchCenter/Pages'
        $web.Update();

    }
}


EASY!


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