SearchCarouselPreviewable

In the Search Carousel on the content edit page, you can add thumbnail images to the search results. This requires implementing SearchCarouselPreviewable on a Content-derived class. The implementation generates a thumbnail image that’s retrieved by SearchCarousel, the servlet that renders the search carousel. The thumbnail appears on the search items for the content type that implements SearchCarouselPreviewable.

../../../_images/carousel.png

Preview thumbnails are typically used on image and video types. You must implement the getSearchCarouselPreview method to return a StorageItem that represents a thumbnail image. The method for the following video type must generate a representative image stored as a StorageItem and return it to the SearchCarousel servlet.

public class Clip extends Video implements SearchCarouselPreviewable {

   @Required
   private String title;

   @Required
   private StorageItem file;

   // getters and setters

   public StorageItem getSearchCarouselPreview(){

    // Generates a StorageItem and returns it to the calling servlet
   }
}

When the SearchCarousel servlet constructs a carousel, it iterates the search results for items that implement SearchCarouselPreviewable, and calls getSearchCarouselPreview for those items. For items that do not implement SearchCarouselPreview, the servlet calls State#getPreview, which returns an image from the item’s state if there is any.

For the Image content type, Brightspot gets preview thumbnails from the state of Image objects. Therefore, Image does not need to implement SearchCarouselPreviewable. However, for thumbnails to be used for the Image type, the PreviewField annotation must be set on the class.

@Recordable.PreviewField("file")
public class Image extends Content {

  private String name;
  private StorageItem file;
  private String altText;

  ...
}