Friday, September 3, 2010

SharePoint Custom Search Results Page - (Search Documents)

The built-in Windows SharePoint Services search results page (SearchResults.aspx) is rather limited in the document metadata that it displays in the result list. Furthermore, the format of the list is not what every client wants. My client wanted lots of document metadata displayed in a "table", and only wanted results from a single document library in the site. So, I created a custom search page to implement this functionality. To display the results, I used a DataGrid, but you could use any formatting you want.

This example shows how to create a custom search results page that will display any metadata available for a document. It is totally flexible in that it gets the metadata fields to display from a client-configured document library view. This means that if the client decides s/he wants more (or fewer) categories to display, or wants to change their order, the results page will automatically adjust when the document library view is changed. This solution uses a simple Content Editor web part with some client-side HTML and JavaScript to invoke the search. This leaves the original search box and search results page for normal site-wide searches (which includes multiple libraries and lists).

Summary of Features:
The search form is implemented as a simple Content Editor web part, containing only client-side HTML and JavaScript.
The search itself is implemented by creating a custom search results page, based on the pre-existing SearchResults.aspx, which uses the built-in SharePoint search functionality and manipulates the results to display more metadata than the standard search results page.
The metadata to display, and the order to display it in, can be changed using a standard SharePoint view on the document library to be searched.
The search results page provides a form field for immediate re-search without having to return to the originating page.
Results can be sorted by clicking on any column header.
Clicking on the document title itself (or the icon) takes the user to the document�s property page.
Built-in search functionality is not affected.
Download SharePoint Custom Search Results Page - (Search Documents)

No comments:

Post a Comment