How to retrieve snippet of attribute from result using java

I have a post with 3 attributes
for text i only want snippet as the text field is large.

         Query query = new Query("searchstring").setAttributesToRetrieve
					(Arrays.asList("title", "authorwebid"));
			SearchResult<SearchPost> result =;

from the result object how do i get snippet of attribute text

Hi @nishant.07, you should be able to use _snippetResult from the response object.

You may also be interested in the snippet widget if you are using instantsearch.

i am able to this via javascript and i get the snippet result but i am unable to do this via java api

You can find the documentation about Java api here: