I was working at a client that was configuring Business Connectivity Services to bring data from an ERP into SharePoint. Of course, the main benefit of bringing it to SharePoint was being able to Search information using the powerful SharePoint 2016 Search Engine.
As you see in the following screenshot, I had 4 External Content Types from which I wanted to bring information in SharePoint. This guide assumes your profile pages for your External Content Types were already created!
First of all I created a new Content Source, setup all the options and run my full Crawl, I was able to search the data in SharePoint! Great!
However, the benefit of SharePoint Search is that you can heavily customize the search in order to bring results that really matter to the user. So, in my Enterprise Search Center, I wanted to add tabs that would only show me results from Projects or Clients. So, I created a new Search Page by clicking on the “Add Page” link in the Search Center and naming it “ClientResults”.
I then went into Site Settings > Search Settings and added a new “link”. I pointed it to “/search/Pages/”
So Now, I did the same for “Projects” As well, so now when I go into my Search Center and click the arrow, I got the “Projects” and “Clients” choices!
But, whenever I Search, it doesn’t filter anything! It’s basically the same as “Everything”. We got to go change this! I will show the screenshots from the point of a SharePoint Administrator, however you can do this even if you don’t have access to the Central Administration! If you are a Power User, you can follow the tutorial from Site Settings > Search. We will use the “Schema” and “Result Sources” option.
Back to Central Administration > Service Applications
> Search Service Applications , on the bottom left, you will click on the “Search Schema“. And then Create a New Managed Property
Here are the Details I gave it:
Now, in the Mappings to crawled properties part, click on “Add a Mapping”
In the “Business Data” Category, choose the “EntityName” crawled property and select OK.
Now, just click on the OK button and the managed property will be created!
Now that we got our managed property, we will need to do a full crawl of both the BCS and the SharePoint Content Sources! This will make sure that the data is crawled, as well as the search schema is updated!
After the full crawl is done, we will go in the Search Service Application > Result Sources and then click New Result Source.
After you fill the initial information, launch the “Query Builder”
In the Query Builder, we will focus on the “Property Filter” part. First of all, click on the “Select Property” dropdown, and choose to “Show all managed properties”
Afterwards, reclick on the dropdown, select the BCSEntityName managed property we just created. The operation must be “Equals“. And then you will choose “Manual Value“. In the textbox right under, insert your database name, in my case it’s “client“. And then click on “Add property Filter“.
We will then click on the “Test Query” button. If everything is ok, you will see a bunch of your records and they are pointing to the good URL of your Profile Page!
Once that works , click on Ok to close the Query Builder, and then OK again to save your new Result Source!
Now, all we have to do is modify the Search Page to show us the right stuff! Navigate to your Search Center, Search for something random and go to the “Clients” Tab. Then, click on the settings wheel and click on “Edit Page”
Then, Edit the Search Results WebPart.
Click the “Change query” button.
In the Select a Query dropdown, choose the ClientBCS option! You can then customize it further in the Refiners & Sorting options, however we won’t go there in this tutorial. Click OK.
Afterwards, click OK on the “Edit WebPart” window.
Afterwards, check in the page and publish it! Now when you search in Clients, you should only find Client Names and nothing else! You are done!
Subscribe to daily updates!