Exercise 3: Using a Custom Ranking Model
Custom Ranking Models are used in conjunction with the Core Results Web Part. The Core Results web part has a DefaultRankingModelID property that takes the ID of the ranking model to use. Unfortunately, this property is not exposed in the property pane. Therefore, you have to add the property into the *.webpart file.
- Navigate to the ImportantTasksResults.aspx page either directly or by running a query.
- Select Site Actions » Edit Page to place the page in edit mode.
On the Search Box Web Part, select Export from the Edit menu.
Export the Search Box web part
- Save the file to your desktop.
- Open the exported file in Visual Studio 2010 for editing.(Note: you will need to open Visual Studio 2010 first, then in the File menu » Open » File… and select the Search_Box.dwp file found on your desktop)
- Within the file, add a new property as follows to have the Core Results Web Part utilize the new ranking model (the GUID is the ID of the ranking model to use):
- (Note: add this just before the </WebPart> tag at the end of the file).
- Save the file and return to the Search Center site at http://intranet.contoso.com/sites/Lab11/searchcenter. (Note: this should still be open from earlier).
- With the ImportantTasksResults.aspx page still in edit mode, place a check in the web part’s top right corner checkbox to select the web part. Then select Insert » Web Part from the ribbon. If the Insert tab is not visible, select the Top Zone. This should make the Insert tab visible.
Select Upload a Web Part and upload the modified file:
Upload the modified Search Box web part
- Drop the modified file on the page. (Note: make sure you are using the newly uploaded copy found in Imported Web Parts and not the original found in the Search folder.)
- Remove the original Search Box web part from the page (i.e. use the Search Box  drop down arrow in the web part’s top right corner to select Delete).
- In the newly added Web Part that contains the search box, click the Web PartMenu drop down arrow in the right upper corner of the web part and pick Edit Web Part.
- In the Search Box task pane, expand the Miscellaneous section. Change the Target search results page URL from ImportantSearchResults.aspx to ImportantTasksResults.aspx and click OK at the bottom of the task pane.
- Now check the page in to save your changes. You can find the Check in button on the Page tab.
- Verify that your new ranking model is working by entering Team as a search term into the Search box.
In this exercise you implemented the custom ranking model you created in the previous exercise.