Everybody loves search. We are so used to going to Google.com or Live.com and having a single textbox to type all our our queries into and having the results come back. SharePoint introduced this in previous versions so you can search your documents and list items, and now with SharePoint 2007 and the Business Data Catalog you can also search your line of business data. This means you can get all document, orders records from SQL Server, and any other customer related data displayed in your search results.
In this article we’ll cover what methods you need to include in your BDC entity to be able to crawl and index them, and how to define your BDC application as a content source within SharePoint.
BDC Application Definition File
If you want your Business Data Catalog entity to be index by SharePoint it needs to contain a couple of important methods, a SpecificFinder and IdEnumerator. The IdEnumerator method is only ever utilized by the search component. All it needs to do it return a list of the identitifer fields for the rows of data you want to index. Once the indexer has executed the IdEnumerator method and has these primary key values, it executes the SpecificFinder method for each key value in turn….getting the columns defined in the SpecificFinder method and indexing them. Therefore, if you want a field from your data source to be searchable, make sure it is being returned in your SpecificFinder method.
Luckily for you BDC Meta Man generates the SpecificFinder and IdEnumerator method for you. The only scenario where you may need to do something manual is if you use web services or a table without a primary key and this just involves selecting which field(s) returned represent the primary key/identifiers.
Configuring Business Data Catalog Search in MOSS 2007
So our application definition file has been imported into our shared service provider and now we need to tell SharePoint to crawl it. To do this complete the following steps:
1, Go to the main shared services administration page
2, Click on Search Settings
3, Click on Content sources and crawl schedules
There should already be the standard content source of ‘Local Office SharePoint Server sites’
4, We want to create a new Content Source so click on the New link
5, Give you Content Source a meaningful name
6, Select the Content Source type to be Business Data
Once you do this the page will reload with the particular options
7, You can choose to crawl all of your BDC applications, or select various onces from the list. If you only want certain entities to be crawled within an application make sure those entities have an IdEnumerator and SpecificFinder method. If you do not want an entity to be crawled you can remove the IdEnumerator method.
8, Next setup your crawl schedules for when you want your Business Data Catalog data to be indexed.
To be clever you may want different BDC applications to be indexed at a different frequency. To achieve this make sure you create seperate content sources for each Business Data Catalog application.
9, Finally tick the box to start a full crawl (if you want to test it out right now of course) and click OK.
We’ll need to wait a little while now for the full crawl to take place. How long – depends on how much data you are indexing.
After waiting a while, and clicking refresh a few times – the indicator should come back as idle and the crawl will be finished.
10, Now we can actually go to our SharePoint portal and search for something. Pressuming you have indexed your Products table from AdventureWorks2000 search for something like – adjustable.
11, Now in your Search results you’ll see a number of products being returned to you.
Take a look at my screenshot above though, I’ve got some tasks and documents also being returned as they have the keyword adjustable somewhere in them. This may be of course what you want, but sometimes you’ll just want your business data being returned on a seperate page. To do this we have to create a custom scope, which will include just the data from our BDC data source.
12, Go back to the Search Settings page of our Shared Service Provider administration site. You’ll see the second section on the page is Scopes. We need to create a new scope for our BDC data so click on View Scopes, then New Scope.
13, Give the scope a name, something memorable such as Products – as you’ll need to type this into a web part later.
14, Once you click OK to add the new scope you’ll be taken back to the scope listings page, where next to your new scope you’ll get a link to ‘Add rules’. Click this link so we can add our Business Data Catalog search scope.
15, Click the button to include a specific content source, and choose your BDC one. Then click OK. Now you need to either start the update of the scopes yourself by clicking the ‘Start update now’ link back on the main search screen – or wait for it to update when it is next scheduled.
When are scopes have been updated we need to go and create and configure a new Search page.
16, Navigate to your SharePoint portal page and go to the search results. Ensure you are logged in with the relevant priviliges and click Site Actions -> Create Page.
17, Give your new page a meaningful name and choose the layout type to be Search Results Page.
18, Your new page will open in Edit Mode. Choose to modify web part properties of the Search Core Results web part.
19, This is the web part that we need to tell which scope to use. This setting is actually a little hidden in the Miscellaneous section. Expand this and type in the name of the scope you created back in step 13.
20, Finally, the Search textbox web part actually redirects queries to another page, so we need to modify this web part so that search queries typed in to products.aspx stay on the current page. Again this setting is in Miscellaneous – and the property we need to change is ‘Target search results page URL’
Now when you publish the page you’ll be able to view just search results from our BDC data source scope rather than including documents and tasks. You will probably want to go to the main search default.aspx and results.aspx and edit them so you can add a tab for your products page. This will make it a lot nicer for your users.
We hope this walkthrough was useful to you. If you have any questions feel free to email them to firstname.lastname@example.org.
Remember you can also watch this walkthrough as a web cast.
Screencast of this walkthrough.