Search Federation Options in SharePoint On-Premises – Part II


In the first post Search Federation Options in SharePoint On-Premises I explained and demonstrated the steps required to setup Federated Search Results from 2 different farms.  To show the results I used two seperate web parts.  One confired to show results from Local SharePoint Result Source and other for the Remote resuls.  In this post I will explain the steps required to merge the results and show them as Result Block. 

To achieve this we hav to rely on two things. 

A Query Rule

Allow us to setup rule to make a search query against a different result source or promote the results based on based on some condition and action.  We can create Query Rules at Central Administration, Site Collection and Site Level.   We can also control when to make this rule active. 

A Result Block

A block of search results that will be displayed based ont he query rule.  we can define how much results will be shown, provide “More” links etc.

For more information please read How To Customize SharePoint 2013 Search Results Using Query Rules and Result Sources

Let’s setup the Query Rule and Result block.

image

The image above is what my results look like before I started.  Two web parts on the search results page.  First I removed the web part from page.  I saw something interesting.  The refinement web part broke. 

image

When I edit the webpart I found Target not found error.  I may have set the default web part to use the remote result source and 2nd web part to local search results.  Once I set the Refinement Targett to Local Search Results, it did not broke.

Creating the Query Rule

Open Central Adminsitration

Manage Service Application

Search Service Application

Under Queries and Results Click on Query Rules

image

From  “For what context do you want to configure rule”  select the Local SharePoint Results. 

Note: I am selecting it because I want to add this result block in default search results.

Then Click New Rule

image 
image

Type in the Rule name.  You can limit the query based on results Sources, Query Categories and User Seagments.  I am not going into that details.

image
Select Query Contdition if any based on your requirements.  In my case I remove the condition entirely.  image
image
In the Actions section. You can either
Add a Promoted Results
It looks like Search keywords and best bets in SharePoint 2010 Search.  You just enter the title and URL and Click Save.

image
image
Add result Block
First you enter the Block Title to make it more clear
If you want to configure Query variable and change and test queries you can launc the Query Builder. 
From Search this Source Select the Remote result Source created in last blog post.
Select the number of Items to show in search results.
image
Expand the Settings Tab
Choose “More” link goes to the following URL and enter the URL of your Search center /pages/results.apsx with ?k={subjectTerms}

image
image
In case needed you can control when this query rule will be available and providethe contact.  image
The result block will be visible now.
Clic Save.
image
The rule will be visible on the Manage Query Rule page. image
Now Let’s test the search results. 
The first part of search results are Federated. 
image
Click on Show More took me to the remote search center. image
I perfomed the exact above step on my other farm to setup two way fedearted results.  Now when I clicked on more to go to other farm the results from first showed up as Federated. image

The same procedure is used to get federated results from Office365.  The link to Technet is here https://technet.microsoft.com/en-us/library/dn197173.aspx

Advertisements