|
||
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 how the fields are named in the found objects, the search dataset always contains the following fields that are automatically mapped to the corresponding object 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 for the particular object. |
content |
This field is mapped to the field specified by the Content field drop-down list on the Search fields tab for the particular object. |
created |
This field is mapped to the field specified by the Date field drop-down list on the Search fields tab for the particular object. |
image |
This field is mapped to the field specified by the Image field drop-down list on the Search fields tab for the particular object. |
In transformations, you can get the values from the dataset by using the Eval("<field name>") function: Eval("score"), Eval("title"), etc.
You can also use the following functions in your transformations:
•SearchResultUrl(bool absolute) - returns the URL of the page where the details of the search result can be found. The parameter indicates if the returned URL should be absolute.
|
Search result URLs for general index results
This method does not return valid URLs for search results produced by a general index, since the indexed objects are not documents and there is no default page where the details are displayed.
A custom transformation function must be written and used in order to generate the correct URL of a custom page displaying the appropriate information. |
•SearchHighlight(string text, string startTag, string endTag) - wraps the text entered in the first attribute into the tags specified by the other two attributes.
•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 maximum side size to which the image will be resized.
•GetSearchValue(string columnName) - returns the value of the specified field for the current search result. This may be used to access both the general fields of the given object type (document, custom table etc.) and any other fields included in the search index.