SharePoint Portal Search Results Demystified (Well starting to)
Recently, I presented at the UK Office Developers Conference at Heathrow. One of the subjects I spoke about was enhancing and extending the Microsoft Office SharePoint Portal Server 2003 Search and I did say that I would post some of that information, as well as the samples I used (including the web part connection samples), up on my blog.
So, this is the first of a few posts and is about explaining the format of the Search Results and the functions that you as a developer can use to override it to fix it up to look like YOU want.
The next post will be one of the custom Search Results web parts that I demonstrated that uses one of the override functions to add a new button (This will be the built version of a previous post here)
So...
The Search Results is split into a number of Rows and Columns and looks like:
You can see that each major functional area of the Search Results can be referred to uniquely.
Now, you can control what each element looks like by using the following functions:
| Name |
Description |
|
protected virtual string GenerateHtmlForItemIcon ( System.Data.DataRow objectDataRow, int iIndexOfItemInDataSet, int iIndexOfItemInGroup, string strElemIDPrefix) |
Generates the HTML that displays the icon for the specified DataRow object in the search result set.
- iIndexOfItemInDataSet Index of row in the result DataSet.
- iIndexOfItemInGroup Index of an item in a group when grouping is enabled. This index is used to expand and collapse groups of results.
- objectDataRow DataRow that represents a single item.
- strElemIDPrefix This element is used for HTML automation and is reserved for internal use only.
|
| protected virtual void GenerateHtmlForRowColumn( System.Data.DataRow oneDataRow, System.Text.StringBuilder strColumnHtml, int iColumn) |
Generates the HTML for the specified column of data for the specified DataRow object in the search result set.
- oneDataRow: Reference to the DataRow in the result set.
- strColumnHtml: StringBuilder that contains the HTML for the specified column. HTML is appended to this string.
- iColumn: Index of the column with HTML content to modify.
|
| protected virtual void GenerateHtmlOneRowForOneItem( System.Data.DataRow oneDataRow, class System.Text.StringBuilder sbRenderRowHtml, int rowID, string strStyleClass, int iIndexOfItemInDataSet, int iIndexOfItemInGroup) |
Generates the HTML for the specified column and row of data for the specified DataRow object in the search result set.
- oneDataRow: DataRow that represents the item in the result set.
- sbRenderRowHtml: StringBuilder that contains the HTML for the specified row.
- rowID: Index of the row of data to generate. 0 indicates that the first HTML table row.
- strStyleClass: Style from the stylesheet that applies to this row. This parameter is reserved for internal use.
- iIndexOfItemInDataSet: Index of this item in the result set to render. 0 represents the first item.
- iIndexOfItemInGroup: Index of this item in its group. This value is used to expand and collapse the result group in the browser.
|
| protected virtual string GenerateQueryString( string strKeyword, System.Collections.ArrayList rgScopeList, string strWhereAndPart, [out] string strSavedQuery) |
Generates the SQL Full-Text Search Syntax query that produces the current result set. • strKeyword: List of keywords specified for this query.
- rgScopeList :List of search scopes specified for this query.
- strWhereAndPart: WHERE clause for the query.
- strSavedQuery: Out parameter that receives the return value from this method.
| |
The next post will demonstrate how to use the GenerateHtmlOneRowForOneItem function in C#