KWizCom Professional Services – www.kwizcom.com
A client of mine once requested that I change the look and feel of their search results page. The client was a large company that had decided to change the design of their SharePoint portal. The portal had a search center which was where I needed to make the change.
This is how I did it:
First of all I needed a Core Results Web Part. You can add a web part to your results page from the Web Parts Gallery or use the SharePoint web part that is automatically added to each search results page.
Next I had to setup the fields (columns) I wanted to see in the search result. To do so - open the properties of the Core results web part and under the Results Query Options change the Selected Columns xml text. To add a new column you need add this text to the xml before tag:
Save the changes and now you can start to redesign the look and feel of the search results. The fastest way to do this is to use the XML of the search results. To access the XML you need to add this code instead of the XSLT code of the web part in the XSL Editor:
Save your changes and do a test search. You will get an XML code of the search results. Copy this code and paste it to notepad. Save the file on your desktop and open SharePoint Designer. Connect to one of your SharePoint sites and create a new blank ASPX page. After this go in to the design mode of your page and add a new DataView Web Part. In the Data Source details choose the XML files and add a new XML file. In the new opened window browse to the file you saved before and import it to SharePoint Designer.
Once you perform this operation you'll see your file in the XML files section. Click on this file and press "Show Data".
Now you will be able to design your Data View Web Part however you want, using columns from the Search Results XML file. You will also be able to perform sorting/filtering/grouping on your search results but keep in mind that each function will create results only on the page you are currently using. In other words, if you sort your search results by site title the grouping will group the content of your current search results page.
After you finish designing your page you the only thing left you need to do is copy the entire code from your page, between the tags
If you would like more information on customizing a search results page I suggest this insightful article by Tobias Zimmergren:
http://www.zimmergren.net/archive/2008/03/15/moss-2007-customize-the-search-result-using-xslt-part-3-customize-using-sharepoint-designer-2007.aspx
SharePoint gives you many options for customizing your search results.
You can define different search results pages for each search scope you run.
You can set a specific search results page on the server level and redirect all search results to that page.
You can even define a search results page for a Search Box Web Part - it will redirect all search results (not including the Contextual Search Scope Search results) to the page you defined.
If you create a new Search Center you may want to redirect all search queries to the Search Center search results page.
You can setup this function on the scopes level or in the Search Settings of the root site in your Site Collection.
I hope this article (and the first two parts of this series) on SharePoint search results has been helpful to you. Please continue to visit the KWizCom blog for more helpful information, SharePoint tips and "how to" guides. We are here to help!
No comments:
Post a Comment