Class SearchHit

java.lang.Object
io.goobi.viewer.model.search.SearchHit
All Implemented Interfaces:
Comparable<SearchHit>

public class SearchHit extends Object implements Comparable<SearchHit>
Wrapper class for search hits. Contains the corresponding BrowseElement
  • Method Details

    • compareTo

      public int compareTo(SearchHit other)
      Specified by:
      compareTo in interface Comparable<SearchHit>
    • addCMSPageChildren

      public void addCMSPageChildren() throws DAOException
      Creates child hit elements for each hit matching a CMS page text, if CMS page texts were also searched.
      Throws:
      DAOException - if any.
    • addFulltextChild

      public void addFulltextChild(org.apache.solr.common.SolrDocument doc, String language) throws IndexUnreachableException, DAOException, ViewerConfigurationException
      Creates a child hit element for TEI full-texts, with child hits of its own for each truncated fragment containing search terms.
      Parameters:
      doc - Solr page doc
      language - a String object.
      Throws:
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • populateChildren

      public void populateChildren(int number, int skip, Locale locale, javax.servlet.http.HttpServletRequest request) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException

      populateChildren.

      Parameters:
      number - a int.
      skip - a int.
      locale - a Locale object.
      request - a HttpServletRequest object.
      Throws:
      PresentationException - if any.
      IndexUnreachableException - if any.
      DAOException - if any.
      ViewerConfigurationException - if any.
    • handleMetadataHit

      public void handleMetadataHit(org.apache.solr.common.SolrDocument childDoc, String fulltext, SolrConstants.DocType docType, boolean acccessDeniedType) throws IndexUnreachableException, PresentationException
      Throws:
      IndexUnreachableException
      PresentationException
    • getFulltext

      public String getFulltext(javax.servlet.http.HttpServletRequest request, String pi, org.apache.solr.common.SolrDocument childDoc) throws FileNotFoundException, PresentationException, AccessDeniedException
      Parameters:
      request -
      pi -
      childDoc -
      Returns:
      Full-text for this search hit
      Throws:
      FileNotFoundException - If the fulltext resource is not found or not accessible
      AccessDeniedException - If the request is missing access rights to the fulltext resource
      PresentationException - I an internal error occurs when trying to retrieve access rights or the fulltext resource
    • getType

      public HitType getType()

      Getter for the field type.

      Returns:
      the type
    • getTranslatedType

      public String getTranslatedType()

      Getter for the field translatedType.

      Returns:
      the translatedType
    • getIconClassForType

      public String getIconClassForType()
    • getBrowseElement

      public BrowseElement getBrowseElement()

      Getter for the field browseElement.

      Returns:
      the browseElement
    • getHitNumber

      public long getHitNumber()
      Returns:
      the hitNumber
    • setHitNumber

      public void setHitNumber(long hitNumber)
      Parameters:
      hitNumber - the hitNumber to set
    • getChildDocs

      public List<org.apache.solr.common.SolrDocument> getChildDocs()

      Getter for the field childDocs.

      Returns:
      the childDocs
    • getHitsPopulated

      public int getHitsPopulated()

      Getter for the field hitsPopulated.

      Returns:
      the hitsPopulated
    • setChildDocs

      public void setChildDocs(org.apache.solr.common.SolrDocumentList childDocs)

      Setter for the field childDocs.

      Parameters:
      childDocs - the childDocs to set
    • isHasChildren

      public boolean isHasChildren()
      Returns true if this hit has populated child elements.
      Returns:
      a boolean.
    • isHasMoreChildren

      public boolean isHasMoreChildren()
      Returns true if this hit has any unpopulated child hits left.
      Returns:
      a boolean.
    • getUgcDocIddocs

      public Set<String> getUgcDocIddocs()

      Getter for the field ugcDocIddocs.

      Returns:
      the ugcDocIddocs
    • getChildren

      public List<SearchHit> getChildren()

      Getter for the field children.

      Returns:
      the children
    • getHitTypeCounts

      public Map<HitType,Integer> getHitTypeCounts()

      Getter for the field hitTypeCounts.

      Returns:
      the hitTypeCounts
    • isHasHitCount

      public boolean isHasHitCount()

      isHasHitCount.

      Returns:
      a boolean.
    • getHitCount

      public int getHitCount()
    • getCmsPageHitCount

      public int getCmsPageHitCount()

      getCmsPageHitCount.

      Returns:
      a int.
    • getDocstructHitCount

      public int getDocstructHitCount()

      getDocstructHitCount.

      Returns:
      a int.
    • getMetadataAndDocstructHitCount

      public int getMetadataAndDocstructHitCount()
    • getPageHitCount

      public int getPageHitCount()

      getPageHitCount.

      Returns:
      a int.
    • getMetadataHitCount

      public int getMetadataHitCount()

      getMetadataHitCount.

      Returns:
      a int.
    • getEventHitCount

      public int getEventHitCount()

      getEventHitCount.

      Returns:
      a int.
    • getUgcHitCount

      public int getUgcHitCount()

      getUgcHitCount.

      Returns:
      a int.
    • getFoundMetadata

      public List<StringPair> getFoundMetadata()

      Getter for the field foundMetadata.

      Returns:
      the foundMetadata
    • addFoundMetadata

      public void addFoundMetadata(StringPair valuePair)
    • getUrl

      public String getUrl()

      Getter for the field url.

      Returns:
      the url
    • getExportMetadata

      public Map<String,String> getExportMetadata()

      Getter for the field exportMetadata.

      Returns:
      the exportMetadata
    • generateNotificationFragment

      public String generateNotificationFragment(int count)
      Generates HTML fragment for this search hit for notification mails.
      Parameters:
      count - a int.
      Returns:
      a String object.
    • setSolrDoc

      public void setSolrDoc(org.apache.solr.common.SolrDocument doc)
      Parameters:
      doc -
    • getSolrDoc

      public org.apache.solr.common.SolrDocument getSolrDoc()
    • getCssClass

      public String getCssClass()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • loadChildHits

      public void loadChildHits(int numChildren) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException
      Throws:
      PresentationException
      IndexUnreachableException
      DAOException
      ViewerConfigurationException
    • getDisplayText

      public String getDisplayText()
    • includeMetadata

      public boolean includeMetadata()