I have BDC and want to call search web service by filtering on certain columns on my database. The way to do is create your BDC application file includes the fields of the tables. Import to sharepoint
If your import is successful you will find the application definition file under ‘View applications’ like the illustration below.
If you click the ‘View entity’ link you will be able to review the entities that were successfully imported along with their data types.
You will then need to create a ‘Content Source’ that will crawl the Business Data. You can set up the BDC crawl for the entire BDC or a specific application.
Make sure you review the crawl log to make sure all of the data you need gets picked up. The next step in the process is to create a managed property to connect to the crawled properties you intend on searching for.
To get to the ‘Managed Properties’ window in SharePoint, you will need to access the Shared Service Provider. Once there, you should find a link to ‘Metadata property mappings’. Click this to proceed.
The default view is the Managed Properties. You should also notice a Crawled Properties link. The easiest way to link managed properties to crawled properties is to click the ‘New Managed Property’ link on the Metadata Property Mappings page. I like to make my property name similar to the crawled property I want to link. For the sake of this demo, I am going to add SPCN10, SPCN13, Title, CategoryName, SeriesCode, PackageCode, and ItemNumber. These are the critical fields that I am envisioning will be needed to bring back results from the Commerce Server product catalog.
To add mapping from the Crawled properties section, click ‘Add Mapping’. This brings up a screen that helps you wade through the list of content. Make sure to select ‘Business Data’ and then type in the property name. I have typed ‘Title’. It brings back the one result I am looking for. In some circumstances you may want to map one Managed Property to several Crawled Properties. I am doing just that with the SPCN10 and SPCN13 values since they are being used as an ISBN number for books in this particular schema. Make sure you remember to check the ‘Allow this property to be used in scopes’.
You need to Full Craw your Content Source before your managed properties will show.
So your search query can look like “SELECT KnowledgeEventCreatedDate , Consultant,Title, Path, Description, Write, Rank,Size,Author,Created,CreatedBy , HitHighlightedSummary FROM SCOPE() WHERE “scope”=’Knowledge’ AND FREETEXT( DefaultProperties,’Ken’) ORDER BY Rank DESC”
Now it’s time to set up some Search Scopes. I am going to create a search scope for Books. Search scopes can be set up in many different levels. First you have the Site Settings\Scopes, then we have Search Settings Scopes, and finally you can set them up at the site collection level.
Once your scope is created, the next step is to add rules to the item. Here is where we tie our property mappings to our scopes. I am going to select ‘Property Query’ here and then select
PackageCode. In my database I am using a package code of ‘BA’, ‘BB’ and ‘BC’ to represent books. You will need to create 3 rules to accommodate the search requirements. Don’t forget that if you want to run the scope right away to click the ‘Start update now’ under the scopes section.
From here all that is needed is to set up your Search Center with your new scope.