1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Customizing Search

Customizing Search

2 posts, 0 answered
  1. Kalvin MacLeod
    Kalvin MacLeod avatar
    19 posts
    Registered:
    15 Nov 2005
    21 Jan 2009
    Link to this post
    Is there an easy place to customize the size of the snippet returned in the Search Results? I don't want to just use Len("Snippet") because it will sometimes cut off right in the middle of an html tag. I'm sure it's something obvious, but can't seem to locate anything.

    Thanks
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Jan 2009
    Link to this post
    Hi Kalvin MacLeod,

    Perhaps you might do it by creating a custom search results set:
    int count; 
    IList<Telerik.Search.Engine.ResultItem> results = Telerik.Search.Engine.SearchManager.Search(q, "SearchTerm", 0, 10, "AnyWord"out count); 
    if (count == 0) 
         rptResults.Visible = false
    else 
         rptResults.DataSource = results; 
         rptResults.DataBind(); 

    Where the SearchTerm is what you have searched for, and the rptResults - the repeater which is showing the results. The result list will be filled with your Search Results items. Each item has the Snippet property you could use. Other than that, the snippets could not be changed or customized, but we will change the individual search result items in our future versions, in order to provide more flexibility and options over the results.

    I hope this helps.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered