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

Forums / Developing with Sitefinity / Search result "Snippet" value

Search result "Snippet" value

10 posts, 0 answered
  1. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    25 May 2011
    Link to this post
    Greetings,

    I am working on my site search (using the built-in search), but all of my search results are coming back with "..." as the short description "snippet".  I've done a lot of digging and searching, but can't seem to figure out why.  Can someone point me in the right direction?

    Thanks!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 May 2011
    Link to this post
    Hello Phillip,

    One of the option is getting the ResultItem from Sitefinity/ControlTemplates/Search/SearchResult.ascx - there is a repeater control and you can access its data item subscribing for ItemDataBound event. Then you can change the snipper of the result item using regular expression.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    26 May 2011
    Link to this post
    Ivan, 

    I don't think the issue is the results control/repeater, as much as it doesn't seem that the data is indexed.  For example, I wrote a simple little script that grabs the search results from the Telerik.Search.SearchManager.Search method and simply writes out each of the properties (Title, URL, Snippet, and Score) of the resulting ResultItem List.  However, the Snippet property just has "..." in it for each of the results.  I think that it may have something to do with how I'm creating my indexes, but I can't seem to figure out why.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 May 2011
    Link to this post
    Hi Phillip,

    I am not saying that this issue is related to the relater. The dots you see are added by the search manager. This is a search results separator that we add. For removing  the dots there are two options

    - replacing the snippet.
    - overriding the SearchManager.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    31 May 2011
    Link to this post
    Ivan,

    I think the problem is that I don't know how to get data _into_ that snippet.  Or is it always just a separator?  I was under the impression that the snippet was supposed to be a description of the page, such as a descriptive summary or block of content including the matched words...i.e., more information about the page other than the title/link.  Is this not the case?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    31 May 2011
    Link to this post
    Hi Phillip,

    We highlight the hits - matches and other data is shortened by the separator. You can access the snippet following this blog post.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    01 Jun 2011
    Link to this post
    Ivan,

    I'm really sorry, but I'm not sure how multilingual results apply to there not being a value in the snippet.  Maybe I'll take another route to explain the issue.

    When I index my site, I get search results that look like this:

    <TItle of Page>
    ... (this is the "snippet" value)
    <url of page>

    Now, for example, in the search results on the Sitefinity/Telerik site, you get something like:

    Team Blog Posts > The new Sitefinity Web Tests Console Demo

    ... the Demo version of our new testing tool – “Sitefinity Web Tests Console”. It is
    based on the same “WebAii v1.1” framework as our Web UI test studio. ...

    http://www.sitefinity.com/blogs/teamblog/posts/09-02-27/the_new_sitefinity_web_tests_console_demo.aspx


    Where the first line is the Title/description of the page, the second block (2 lines in this case) are a short description, and the last line is a link to the page. 

    What I need to figure out is this...why am I not getting the brief description between the first and last lines?  I kind of assumed that this would be stored in the "snippet" value of the object, but all that is in there is "...".  Is there no way for me to get a brief description of the page?  I really need some help on this, because I'm about a month behind on this search feature, and I just can't find any information as to what I'm doing wrong.  Am I indexing the information wrong?  Am I looking in the wrong place for the short description of the search result?

    Thanks for all your help so far.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Jun 2011
    Link to this post
    Hi,

    The post shows how to get access to the snippet and modify it which is what you need. The search results returns matches from the hits.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Tech
    Tech avatar
    26 posts
    Registered:
    13 Sep 2010
    02 Jun 2011
    Link to this post
    Ivan,

    I took another look at your post, and implemented it as described in the blog post, but I'm still not able to see how the data is being populated in the ResultItem object. I can get each one as it hits the repeater (which I could also do progamatically) but the values stored in the ResultItem don't seem to contain anything meaningful.

    For example, the ResultItem object that is being used by the repeater has 4 main properties that I can tell:

    1) Score
    2) Snippet
    3) Title
    4) URL

    I can see the Score, Title, and URL values being populated as expected, but I can't figure out how to get some sort of meaningful description into the Snippet search result.  I would expect that this would be generated by the indexing service somehow when it indexes all of the content.  I think the problem I'm having is I can't figure out WHY the indexing service isn't putting a value into the Snippet property that contains anything meaningful.
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Jun 2011
    Link to this post
    Hello Phillip,

    The results separator is appended to the snippet. If you want you can create a custom class that mimics the behavior of SearchManager.Search and create a result item. Inside the custom method that mimic SearchManager.Search behavior you have to remove the separator. You could take a look at this thread.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
10 posts, 0 answered