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(jakarta.servlet.http.HttpServletRequest request, String pi, String authorityIdentifier, org.apache.solr.common.SolrDocument childDoc) intlongintGetter for the fieldhitsPopulated.intGetter for the fieldhitTypeCounts.Deprecated.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, jakarta.servlet.http.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- aStringobject.- 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, jakarta.servlet.http.HttpServletRequest request) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException populateChildren.
- Parameters:
number- a int.skip- a int.locale- aLocaleobject.request- aHttpServletRequestobject.- 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-fulltext-docType-acccessDeniedType-- Throws:
DAOExceptionIndexUnreachableExceptionPresentationException
-
getFulltext
public String getFulltext(jakarta.servlet.http.HttpServletRequest request, String pi, String authorityIdentifier, org.apache.solr.common.SolrDocument childDoc) throws FileNotFoundException, PresentationException, AccessDeniedException - Parameters:
request-pi-authorityIdentifier-childDoc-- 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 field
type.- Returns:
- the type
-
getTranslatedType
Getter for the field
translatedType.- Returns:
- the translatedType
-
getIconName
-
getIconClassForType
Deprecated.usegetIconName()instead.- Returns:
String
-
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
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
Getter for the field
ugcDocIddocs.- Returns:
- the ugcDocIddocs
-
getChildren
Getter for the field
children.- Returns:
- the children
-
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.
-
getArchiveHitCount
public int getArchiveHitCount()getArchiveHitCount.
- Returns:
- a int.
-
getFoundMetadata
Getter for the field
foundMetadata.- Returns:
- the foundMetadata
-
addFoundMetadata
-
getUrl
Getter for the field
url.- Returns:
- the url
-
getAltUrl
- Returns:
- the altUrl
-
setAltUrl
- Parameters:
altUrl- the altUrl to set
-
getAltLabel
- Returns:
- the altLabel
-
setAltLabel
- Parameters:
altLabel- the altLabel to set
-
getExportMetadata
Getter for the field
exportMetadata.- Returns:
- the exportMetadata
-
generateNotificationFragment
Generates HTML fragment for this search hit for notification mails.- Parameters:
count- a int.- Returns:
- a
Stringobject.
-
setSolrDoc
public void setSolrDoc(org.apache.solr.common.SolrDocument doc) - Parameters:
doc-
-
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()
-
getIconName()instead.