Package io.goobi.viewer.model.search
Class SearchHit
java.lang.Object
io.goobi.viewer.model.search.SearchHit
- All Implemented Interfaces:
Comparable<SearchHit>
Wrapper class for search hits. Contains the corresponding
BrowseElement-
Method Summary
Modifier and TypeMethodDescriptionintCreates child hit elements for each hit matching a CMS page text, if CMS page texts were also searched.voidaddFoundMetadata(StringPair valuePair) intaddFulltextChild(org.apache.solr.common.SolrDocument doc, String language) Creates a child hit element for TEI full-texts, with child hits of its own for each truncated fragment containing search terms.intgenerateNotificationFragment(int count) Generates HTML fragment for this search hit for notification mails.intgetArchiveHitCount.Getter for the fieldbrowseElement.intList<org.apache.solr.common.SolrDocument> Getter for the fieldchildDocs.Getter for the fieldchildren.intgetCmsPageHitCount.intgetDocstructHitCount.intgetEventHitCount.Getter for the fieldexportMetadata.Getter for the fieldfoundMetadata.getFulltext(HttpServletRequest request, String pi, String authorityIdentifier, org.apache.solr.common.SolrDocument childDoc) intlongintGetter for the fieldhitsPopulated.intGetter for the fieldhitTypeCounts.intintgetMetadataHitCount.intgetPageHitCount.org.apache.solr.common.SolrDocumentGetter for the fieldtranslatedType.getType()Getter for the fieldtype.Getter for the fieldugcDocIddocs.intgetUgcHitCount.getUrl()Getter for the fieldurl.voidhandleMetadataHit(org.apache.solr.common.SolrDocument childDoc, String fulltext, SolrConstants.DocType docType, boolean acccessDeniedType) booleanbooleanReturns true if this hit has populated child elements.booleanisHasHitCount.booleanReturns true if this hit has any unpopulated child hits left.voidloadChildHits(int numChildren) voidpopulateChildren(int number, int skip, Locale locale, HttpServletRequest request) populateChildren.voidsetAltLabel(String altLabel) voidvoidsetChildDocs(org.apache.solr.common.SolrDocumentList childDocs) Setter for the fieldchildDocs.voidsetHitNumber(long hitNumber) voidsetHitsPopulated(int hitsPopulated) voidsetHitsPreloaded(int hitsPreloaded) voidsetSolrDoc(org.apache.solr.common.SolrDocument doc) toString()
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<SearchHit>
-
setHitsPopulated
public void setHitsPopulated(int hitsPopulated) -
setHitsPreloaded
public void setHitsPreloaded(int hitsPreloaded) -
getHitsPreloaded
public int getHitsPreloaded() -
addCMSPageChildren
Creates child hit elements for each hit matching a CMS page text, if CMS page texts were also searched.- Returns:
- the number of child hits added
- Throws:
DAOException- if any.
-
addFulltextChild
public int 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 doclanguage- BCP 47 language code for TEI file lookup- Returns:
- the number of child hits added
- Throws:
IndexUnreachableException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getChildDocCount
public int getChildDocCount() -
populateChildren
public void populateChildren(int number, int skip, Locale locale, HttpServletRequest request) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException populateChildren.- Parameters:
number- maximum number of child hits to populateskip- number of child hits to skip before populatinglocale- locale used for label translationsrequest- current HTTP request used for access checks- 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 DAOException, IndexUnreachableException, PresentationException - Parameters:
childDoc- the child Solr document to processfulltext- full-text content for page hits, may be nulldocType- document type of the child documentacccessDeniedType- true if access to this document was denied- Throws:
DAOExceptionIndexUnreachableExceptionPresentationException
-
getFulltext
public String getFulltext(HttpServletRequest request, String pi, String authorityIdentifier, org.apache.solr.common.SolrDocument childDoc) throws FileNotFoundException, PresentationException, AccessDeniedException - Parameters:
request- the current HTTP request, used for access checkspi- persistent identifier of the recordauthorityIdentifier- authority data identifier used to highlight named entity tags; may be nullchildDoc- Solr page document providing fulltext filename fields- Returns:
- Full-text for this search hit
- Throws:
FileNotFoundException- If the fulltext resource is not found or not accessibleAccessDeniedException- If the request is missing access rights to the fulltext resourcePresentationException- I an internal error occurs when trying to retrieve access rights or the fulltext resource
-
getType
Getter for the fieldtype.- Returns:
- the hit type classifying the kind of content this search hit represents
-
getTranslatedType
Getter for the fieldtranslatedType.- Returns:
- the message key for the translated hit type label, or an empty string if no type is set
-
getIconName
-
getBrowseElement
Getter for the fieldbrowseElement.- Returns:
- the browse element containing the display metadata for this search hit
-
getHitNumber
public long getHitNumber() -
setHitNumber
public void setHitNumber(long hitNumber) -
getChildDocs
Getter for the fieldchildDocs.- Returns:
- the list of unpopulated child Solr documents to be lazily expanded for this hit
-
getHitsPopulated
public int getHitsPopulated()Getter for the fieldhitsPopulated.- Returns:
- the number of child hits that have already been populated for display
-
setChildDocs
public void setChildDocs(org.apache.solr.common.SolrDocumentList childDocs) Setter for the fieldchildDocs.- Parameters:
childDocs- the list of unpopulated child Solr documents to be lazily expanded for this hit
-
isHasChildren
public boolean isHasChildren()Returns true if this hit has populated child elements.- Returns:
- true if this hit has at least one populated child search hit, false otherwise
-
isHasMoreChildren
public boolean isHasMoreChildren()Returns true if this hit has any unpopulated child hits left.- Returns:
- true if there are more child hits available beyond those already populated, false otherwise
-
getUgcDocIddocs
Getter for the fieldugcDocIddocs.- Returns:
- the set of IDDOC values for user-generated content documents associated with this hit
-
getChildren
Getter for the fieldchildren.- Returns:
- the list of populated child search hits for this result
-
getHitTypeCounts
Getter for the fieldhitTypeCounts.- Returns:
- the map of hit type to count of child hits of that type
-
isHasHitCount
public boolean isHasHitCount()isHasHitCount.- Returns:
- true if at least one hit type has a count greater than zero, false otherwise
-
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.
-
getArchiveHitCount
public int getArchiveHitCount()getArchiveHitCount.- Returns:
- a int.
-
getFoundMetadata
Getter for the fieldfoundMetadata.- Returns:
- an unmodifiable list of label-value pairs for metadata fields that matched the search query
-
addFoundMetadata
-
getUrl
Getter for the fieldurl.- Returns:
- the URL for this search hit's detail page
-
getAltUrl
-
setAltUrl
-
getAltLabel
-
setAltLabel
-
getExportMetadata
Getter for the fieldexportMetadata.- Returns:
- the map of metadata field names to values used for exporting this search hit
-
generateNotificationFragment
Generates HTML fragment for this search hit for notification mails.- Parameters:
count- sequential position of this hit in the notification list- Returns:
- the HTML table row fragment for this search hit in a notification email
-
setSolrDoc
public void setSolrDoc(org.apache.solr.common.SolrDocument doc) - Parameters:
doc- the Solr document to set
-
getSolrDoc
public org.apache.solr.common.SolrDocument getSolrDoc() -
getCssClass
-
toString
-
loadChildHits
public void loadChildHits(int numChildren) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException -
getDisplayText
-
includeMetadata
public boolean includeMetadata()
-