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 TypeMethodDescriptionint
Creates child hit elements for each hit matching a CMS page text, if CMS page texts were also searched.void
addFoundMetadata
(StringPair valuePair) int
addFulltextChild
(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.int
generateNotificationFragment
(int count) Generates HTML fragment for this search hit for notification mails.int
getArchiveHitCount.Getter for the fieldbrowseElement
.int
List<org.apache.solr.common.SolrDocument>
Getter for the fieldchildDocs
.Getter for the fieldchildren
.int
getCmsPageHitCount.int
getDocstructHitCount.int
getEventHitCount.Getter for the fieldexportMetadata
.Getter for the fieldfoundMetadata
.getFulltext
(javax.servlet.http.HttpServletRequest request, String pi, String authorityIdentifier, org.apache.solr.common.SolrDocument childDoc) int
long
int
Getter for the fieldhitsPopulated
.int
Getter for the fieldhitTypeCounts
.int
int
getMetadataHitCount.int
getPageHitCount.org.apache.solr.common.SolrDocument
Getter for the fieldtranslatedType
.getType()
Getter for the fieldtype
.Getter for the fieldugcDocIddocs
.int
getUgcHitCount.getUrl()
Getter for the fieldurl
.void
handleMetadataHit
(org.apache.solr.common.SolrDocument childDoc, String fulltext, SolrConstants.DocType docType, boolean acccessDeniedType) boolean
boolean
Returns true if this hit has populated child elements.boolean
isHasHitCount.boolean
Returns true if this hit has any unpopulated child hits left.void
loadChildHits
(int numChildren) void
populateChildren
(int number, int skip, Locale locale, javax.servlet.http.HttpServletRequest request) populateChildren.void
setAltLabel
(String altLabel) void
void
setChildDocs
(org.apache.solr.common.SolrDocumentList childDocs) Setter for the fieldchildDocs
.void
setHitNumber
(long hitNumber) void
setHitsPopulated
(int hitsPopulated) void
setHitsPreloaded
(int hitsPreloaded) void
setSolrDoc
(org.apache.solr.common.SolrDocument doc) toString()
-
Method Details
-
compareTo
- Specified by:
compareTo
in 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
- aString
object.- 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, javax.servlet.http.HttpServletRequest request) throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException populateChildren.
- Parameters:
number
- a int.skip
- a int.locale
- aLocale
object.request
- aHttpServletRequest
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 -
getFulltext
public String getFulltext(javax.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
-
getIconClassForType
-
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
String
object.
-
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()
-