Package io.goobi.viewer.model.search
Class SearchHitFactory
java.lang.Object
io.goobi.viewer.model.search.SearchHitFactory
Factory class that constructs
SearchHit objects from Solr documents, enriching them with metadata,
thumbnails, child hits, and access permission information.-
Constructor Summary
ConstructorsConstructorDescriptionSearchHitFactory(Map<String, Set<String>> searchTerms, List<StringPair> sortFields, List<String> exportFields, int proximitySearchDistance, ThumbnailHandler thumbnailHandler, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptioncreateSearchHit(org.apache.solr.common.SolrDocument doc, org.apache.solr.common.SolrDocument ownerDoc, String fulltext, HitType overrideType) createSearchHit.getHitType(HitType overrideType, StructElement se, String docType) setAdditionalMetadataListType(String additionalMetadataListType)
-
Constructor Details
-
SearchHitFactory
public SearchHitFactory(Map<String, Set<String>> searchTerms, List<StringPair> sortFields, List<String> exportFields, int proximitySearchDistance, ThumbnailHandler thumbnailHandler, Locale locale) - Parameters:
searchTerms- map of Solr field names to sets of search terms for highlightingsortFields- list of sort fields to append as metadataexportFields- list of Solr field names to include in export metadataproximitySearchDistance- word distance for proximity/fuzzy searchthumbnailHandler- handler used to build thumbnail URLslocale- locale for label translation and message resolution
-
-
Method Details
-
createSearchHit
public SearchHit createSearchHit(org.apache.solr.common.SolrDocument doc, org.apache.solr.common.SolrDocument ownerDoc, String fulltext, HitType overrideType) throws PresentationException, IndexUnreachableException, DAOException createSearchHit.- Parameters:
doc- aSolrDocumentobject.ownerDoc- aSolrDocumentobject.fulltext- Optional fulltext (page docs only).overrideType- aHitTypeobject.- Returns:
- the SearchHit built from the given Solr document, with metadata and fulltext fragments
- Throws:
PresentationException- if any.IndexUnreachableException- if any.DAOException
-
getHitType
-
setAdditionalMetadataListType
- Parameters:
additionalMetadataListType- the key of the metadata list type to use for additional metadata on search hits- Returns:
- this
-
setUser
- Parameters:
user- the user for whom access conditions of the search hits should be calculated. If ommitted, the user is fetched from the jsfContext If one exists- Returns:
- this
-
getAdditionalMetadataIgnoreFields
-
getAdditionalMetadataTranslateFields
-
getAdditionalMetadataOneLineFields
-
getAdditionalMetadataSnippetFields
-
getAdditionalMetadataNoHighlightFields
-