You can use the following default transformations to display search results by the Smart search dialog with results and Smart search results web parts:
• | CMS.Root. SmartSearchResults |
• | CMS.Root. SmartSearchResultsWithImages |
Search results are returned in 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, while 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 fake dataset by using the Eval("<field name>") funciton: Eval("score"), Eval("title"), ...
You can also use the following methods in your transformations:
• | SearchResultUrl(bool absolute) - returns URL to the document; the attribute 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 URL of the current search result's image; the first attribute specifies URL returned in no image found, the second one specifies the maximal side size to which the image will be resized |
• | GetSearchValue(string columnName) - returns specified column's value for the current search result |
Page url: http://devnet.kentico.com/docs/devguide/index.html?smart_search_transformations.htm