Package io.goobi.viewer.model.archives
Class SolrEADParser
java.lang.Object
io.goobi.viewer.model.archives.ArchiveParser
io.goobi.viewer.model.archives.SolrEADParser
- All Implemented Interfaces:
Serializable
Loads and parses EAD documents from the Solr index.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.goobi.viewer.model.archives.ArchiveParser
ArchiveParser.UnparsedNodeSearchResult -
Field Summary
Fields inherited from class io.goobi.viewer.model.archives.ArchiveParser
associatedRecordMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the database names.getUrl()booleanloadChildren(ArchiveEntry entry) Loads the immediate children of the given entry, if not yet loaded.loadDatabase(ArchiveResource database, int lazyLoadingThreshold) Loads the given database and parses the EAD document.loadEntryPath(ArchiveEntry root, String nodeId) Loads all levels of the tree between the given root node and the node with the given EAD node ID.loadNode(int order, int hierarchy, org.apache.solr.common.SolrDocument doc, boolean loadChildrenRecursively) Creates anArchiveEntryfor the given Solr document.searchInUnparsedNodes(ArchiveEntry node, String searchValue) Searches the index for nodes of an on-demand loaded archive that match the given value and loads the tree path to each hit.toString()Methods inherited from class io.goobi.viewer.model.archives.ArchiveParser
getAssociatedRecordPis, getIdForName, updateAssociatedRecordMap, updateAssociatedRecordMapIfChanged
-
Constructor Details
-
SolrEADParser
public SolrEADParser()
-
-
Method Details
-
getPossibleDatabases
public List<ArchiveResource> getPossibleDatabases() throws PresentationException, IndexUnreachableExceptionGets the database names.- Specified by:
getPossibleDatabasesin classArchiveParser- Returns:
- List
- Throws:
IndexUnreachableExceptionPresentationException
-
loadDatabase
public ArchiveEntry loadDatabase(ArchiveResource database, int lazyLoadingThreshold) throws PresentationException, IndexUnreachableException Loads the given database and parses the EAD document. Archives with fewer nodes than the given threshold are loaded entirely in one query. Larger archives are loaded on demand: only the root and its children are built here, deeper levels are loaded from Solr when they are expanded, selected or found by a search.- Specified by:
loadDatabasein classArchiveParser- Parameters:
database- the archive resource to loadlazyLoadingThreshold- minimum tree size to switch to on-demand loading- Returns:
- Root element of the loaded tree
- Throws:
IndexUnreachableExceptionPresentationException
-
loadNode
public ArchiveEntry loadNode(int order, int hierarchy, org.apache.solr.common.SolrDocument doc, boolean loadChildrenRecursively) throws PresentationException, IndexUnreachableException Creates anArchiveEntryfor the given Solr document. The children of the root node (hierarchy 0) are always loaded.- Parameters:
order- position of this node within its parent's childrenhierarchy- depth level of this node in the treedoc- Solr document representing this archive entryloadChildrenRecursively- if true, child nodes are loaded recursively- Returns:
ArchiveEntry- Throws:
IndexUnreachableExceptionPresentationException
-
loadChildren
public boolean loadChildren(ArchiveEntry entry) throws PresentationException, IndexUnreachableException Loads the immediate children of the given entry, if not yet loaded.- Overrides:
loadChildrenin classArchiveParser- Parameters:
entry- the parent entry whose children are to be loaded- Returns:
- true if children were loaded by this call; false if they were already loaded or the entry has no children
- Throws:
PresentationExceptionIndexUnreachableException
-
loadEntryPath
public ArchiveEntry loadEntryPath(ArchiveEntry root, String nodeId) throws PresentationException, IndexUnreachableException Loads all levels of the tree between the given root node and the node with the given EAD node ID.- Overrides:
loadEntryPathin classArchiveParser- Parameters:
root- Root node of the treenodeId- EAD node ID of the requested node- Returns:
- Loaded
ArchiveEntrywith the given ID; null if not found - Throws:
PresentationExceptionIndexUnreachableException
-
searchInUnparsedNodes
public ArchiveParser.UnparsedNodeSearchResult searchInUnparsedNodes(ArchiveEntry node, String searchValue) Searches the index for nodes of an on-demand loaded archive that match the given value and loads the tree path to each hit. Paths are loaded for at mostMAX_UNPARSED_SEARCH_HITShits and for at mostMAX_NODES_LOADED_PER_SEARCHnewly loaded nodes in total; if either limit is reached, the result is flagged as incomplete.- Specified by:
searchInUnparsedNodesin classArchiveParser- Parameters:
node- Any node of the archive treesearchValue- Search terms- Returns:
ArchiveParser.UnparsedNodeSearchResult
-
getUrl
- Specified by:
getUrlin classArchiveParser
-
toString
-