Setting MoreLinkUrl when provisioning a CoreResultsWebPart in SharePoint 2010


This post outlines how to set the MoreLinkUrl property of the CoreResultsWebPart in SharePoint 2010.

My current project needed me to provision a CoreResultsWebPart on a search results page and returns results from a search scope then provide a link to a different search results page that provided more comprehensive results via the More button included with the CoreResultsWebPart.

I was using the AllUsersWebPart node in a module.


 

I was then setting the property of the CoreResultsWebPart MoreLinkUrl like below:

<property name=”MoreLinkUrl” type=”string”>peopleresults.aspx</property>

However this was having no effect on the rendered WebPart at all no matter what I set it to.

I went over to the MSDN page for the CoreResultsWebPart MoreLinkUrl property and found this description:

Gets or sets the URL for displaying additional search results from the location”

The key word here is location. When you do not set a federated location for the CoreResultsWebPart it defaults to the LocalSearchIndex location, which means the results come from the local search index surprisingly.

When you open the Local Search Index location in the search service application.

Click on the Local Search Results location and scroll down to the More Results Link template under the Location Information section, you can see this is where the CoreResultsWebPart is getting it’s link from.

Now what I did to modify this is to create a new location and change this template to point to my other search results page, I then modified the location for the CoreResultsWebPart in my module and re-deployed.

<property name=”Location” type=”string”>CustomDatabaseArtists</property>

 

 

Now my CoreResultsWebPart More Link button points to my new search results page.

 

 

One thought on “Setting MoreLinkUrl when provisioning a CoreResultsWebPart in SharePoint 2010

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s