How to modify the search results of a search core result web part in SharePoint?

  • Posted by: Softree Technology

imageSharePoint generally facilitates 2 types of web parts that we can use to perform a search with in a predefined scope. One of those two parts is search box web part, which contains a text box and a dropdown menu. The text box is used for entering the search keywords while dropdown includes the value of search scopes. Another web part from SharePoint is search core results web part that helps to display the search results.

To classify a new scope, you have to navigate to the site settings of the root site, click on the search scope in the site collection administration, where you will see display groups containing search scopes. Click on the new scope button to add a new scope. The easiest way you can follow to do this is by navigating to the SharePoint Service Provider (SSP) present in the Central Administration Panel.

Now, to show the search results in the search core results web part we need to set the properties “Target search results page URL” of the search box web part .To set these properties go to Site Actions -> Edit Page -> Modify Shared Web part (of search box) -> Miscellaneous. , provide the value for the properties (the value will be the URL of the page where the search core results web part is present).

You need to set the properties in the Target search results page URL to show the search results in the search core results web part, which you can do by navigating to the search box web part. In order to allocate the properties, navigate to Site Actions -> Edit Page -> Modify Shared Web part (of search box) -> Miscellaneous, subsequently set the value to the properties (set the URL of the page, where the value of the properties is present).

For instance, you have classified a search scope that is pointing to a list (“Test Scope” to a “Test List”). Then the search will be acted upon on the list of the items. Now let’s say, you performed a search, then the results will display the link and specific items, which contain the exact search keywords.

However, if you want your web part to show the details of the list item in an organized format then all you have to do is to put the value of the list items in the search core result web part.

Step -1:

To make this column value available in the search core result web part we need to add the “Managed Properties” in the “Metadata Property Mappings”. To add the Managed Properties Go to the

To make the above mentioned value accessible in the search core result web part, you ought to append the “Managed Properties” in the mappings of “Meta Data Property”. To affix this value navigate to the

Central Administration => SSP => Search Setting s => Metadata property mappings => New Managed Property => give the Property Name => choose the Type(The type will be alike to the list column type) => Hit on Add Mappings => choose the column from the crawled property (Column name will have a prefix ows_ColumnName) => ok.

Step – 2 :

Now navigate to the search core result web part page  and subsequently Click on Site Actions => Edit page = > Modify Shared Web part => navigate to the Result Query Options => Hit the Selected Columns , then attach the field inside the columns tag .

<Columns>

<Column Name=”propertyname”/>

……..

……….

</Columns>

Step-3

Now open the XSL Editor and reinstate with the following code.

<?xml version=”1.0″ encoding=”UTF-8″?> <xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <xsl:output method=”xml” version=”1.0″ encoding=”UTF-8″ indent=”yes”/> <xsl:template match=”/”> <xmp><xsl:copy-of select=”*”/></xmp> </xsl:template> </xsl:stylesheet>

Step – 4:

Now you have to insert the DataFormWebpart in a page (inside the SharePoint designer). In the “Data Source Library “ Task Pane go the “XML Files” section click on the “Add an XML file” and add the XML file.

Now click on the XML file and then go for the “Show Data”. Then choose the columns which you would like to illustrate in search result page (At this point you can see the columns which you had previously attached in the Metadata property). Now choose the select the view option from the “Insert selected Field as”. By modifying the XSLT of the DataFormWebPart, you can format the columns easily.

Step – 5:

In the DataFormWebPart copy the codes between the <xsl:stylesheet> </xsl:stylesheet> tag. Now replace the code present between the <xsl:stylesheet> </xsl:stylesheet> tag ‘s with the copied content(in the the XSL Editor of the Search Core Results web part) .

That’s it…Now you will see the search results will be in same format which you have set in the DataFormWebpart.

Softree Technology employs SharePoint consultants, who are experienced in writing for a multiplicity of SharePoint verticals including technical, promotional, creative, branding content, cataloguing and ethical media comprising journalism.

With more than 10 years of industry experience these professionals have the best resources to deliver optimum results. They have been satisfying customers with some of the best SharePoint Strategies. In case you need experts for Offshore development for SharePoint 2016, we have got you covered.

Author: Softree Technology

Leave a Reply