You can use the following default transformations to display search results using the Smart search dialog with results and Smart search results web parts:
• | CMS.Root.SmartSearchResults |
• | CMS.Root.SmartSearchResultsWithImages |
Search results are returned in a so-called search dataset. No matter what the field names in the found documents are, the search dataset always contains the following fields that are mapped to the real documents' fields:
score |
Expresses the relevance of the found document in a numeric value ranging from 0 to 1, where higher values indicate higher relevance. |
title |
This field is mapped to the field specified by the Title field drop-down list on the Search fields tab of the particular document type. |
content |
This field is mapped to the field specified by the Content field drop-down list on the Search fields tab of the particular document type. |
created |
This field is mapped to the field specified by the Date field drop-down list on the Search fields tab of the particular document type. |
image |
This field is mapped to the field specified by the Image field drop-down list on the Search fields tab of the particular document type. |
In transformations, you can get the values from the dataset by using the Eval("<field name>") function: Eval("score"), Eval("title"), ...
You can also use the following methods in your transformations:
• | SearchResultUrl(bool absolute) - returns the URL to the document; the parameter indicates if the returned URL should be absolute |
• | SearchHighlight(string text, string startTag, string endTag) - wraps the text entered in the first attribute by the tags specified by the other two attribute |
• | GetSearchImageUrl(string noImageUrl, int maxSideSize) - returns the URL of the current search result image; the first attribute specifies the URL returned if no image is found, the second one specifies the maximal side size to which the image will be resized |
• | GetSearchValue(string columnName) - returns the value of the specified column for the current search result |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?smart_search_transformations.htm