Class SearchResult<T>

java.lang.Object
com.atlassian.confluence.api.model.search.SearchResult<T>
Type Parameters:
T - entityRef type - the type of the wrapped result
All Implemented Interfaces:
com.atlassian.sal.api.search.SearchMatch
Direct Known Subclasses:
ContentSearchResult, SpaceSearchResult, UserSearchResult

public abstract class SearchResult<T> extends Object implements com.atlassian.sal.api.search.SearchMatch
A result of a search. SearchResult is a adapter around another result entity to make representing polymorphic search results simpler. The original entity is available via the getEntity() method
  • Method Details

    • getEntity

      public T getEntity()
    • getEntityRef

      public abstract Reference<T> getEntityRef()
      Returns:
      a reference to the result entity that this searchResult wraps.
    • getEntityType

      public final String getEntityType()
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface com.atlassian.sal.api.search.SearchMatch
    • getExcerpt

      public String getExcerpt()
      Specified by:
      getExcerpt in interface com.atlassian.sal.api.search.SearchMatch
    • getUrl

      public String getUrl()
      Specified by:
      getUrl in interface com.atlassian.sal.api.search.SearchMatch
    • getIconCssClass

      public String getIconCssClass()
    • getLastModifiedAt

      public OffsetDateTime getLastModifiedAt()
      Since:
      8.6
    • getFriendlyLastModified

      public String getFriendlyLastModified()
    • getResultParentRef

      public Reference<ContainerSummary> getResultParentRef()
    • getResultParent

      @Deprecated public ContainerSummary getResultParent()
      Deprecated.
      since 5.9 Use getResultParentContainer() instead.
      Returns:
      the container of this result if it is different to what is returned by getResultGlobalContainer.
    • getResultParentContainer

      public ContainerSummary getResultParentContainer()
      Returns:
      the container of this result if it is different to what is returned by getResultGlobalContainer.
      Since:
      5.9
    • getResultGlobalContainerRef

      public Reference<ContainerSummary> getResultGlobalContainerRef()
    • getResultGlobalContainer

      public ContainerSummary getResultGlobalContainer()
      The top level container of the result that is not contained in another container.

      For example, if this result referenced a comment, a comment is contained in a page, and a page is contained in a space, but a space is not contained in another entity. This method would return a summary of the space.

    • getResourceType

      public com.atlassian.sal.api.search.ResourceType getResourceType()
      Specified by:
      getResourceType in interface com.atlassian.sal.api.search.SearchMatch
    • builder

      public static <T> SearchResult.Builder<T> builder(T entity)