Package org.dspace.discovery.indexobject
Class ItemIndexFactoryImpl
java.lang.Object
org.dspace.discovery.indexobject.IndexFactoryImpl<T,S>
org.dspace.discovery.indexobject.DSpaceObjectIndexFactoryImpl<IndexableItem,Item>
org.dspace.discovery.indexobject.ItemIndexFactoryImpl
- All Implemented Interfaces:
DSpaceObjectIndexFactory<IndexableItem,,Item> IndexFactory<IndexableItem,,Item> ItemIndexFactory
public class ItemIndexFactoryImpl
extends DSpaceObjectIndexFactoryImpl<IndexableItem,Item>
implements ItemIndexFactory
Factory implementation for indexing/retrieving items in the search core
- Author:
- Kevin Van de Velde (kevin at atmire dot com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorityValueServiceprotected ChoiceAuthorityServiceprotected HandleServiceprotected ItemServiceprotected MetadataAuthorityServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected VersionHistoryServiceprotected WorkflowItemIndexFactoryprotected WorkspaceItemIndexFactoryprotected WorkspaceItemServiceprotected XmlWorkflowItemServiceFields inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
solrSearchCore, solrServiceIndexPlugins -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDiscoveryFields(org.apache.solr.common.SolrInputDocument doc, Context context, Item item, List<DiscoveryConfiguration> discoveryConfigurations) Store item fields in the solr documentorg.apache.solr.common.SolrInputDocumentbuildDocument(Context context, IndexableItem indexableItem) Build a Solr document for a DSpace Item and write the indexorg.apache.solr.common.SolrInputDocumentbuildNewDocument(Context context, IndexableItem indexableItem) Create solr document with all the shared fields initialized.voidRemove the provided indexable object from the solr corevoiddelete(IndexableItem indexableObject) Remove the provided indexable object from the solr coreRetrieve all instances of a certain indexable object typefindIndexableObject(Context context, String id) Retrieve a single indexable object using the provided identifiergetIndexableObjects(Context context, Item item) Retrieve all the indexable objects for the provided objectgetLocations(Context context, IndexableItem indexableDSpaceObject) Return a list of the identifiers from the parents for the provided IndexableObject, communities will be prepended by "m", collections b "c"getType()Return the type of the indexable objectbooleanDetermine whether the class can handle the factory implementationvoidwriteDocument(Context context, IndexableItem indexableObject, org.apache.solr.common.SolrInputDocument solrInputDocument) Write the provided document to the solr coreMethods inherited from class org.dspace.discovery.indexobject.DSpaceObjectIndexFactoryImpl
addContainerMetadataField, storeCommunityCollectionLocationsMethods inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
addFacetIndex, addFacetIndex, addNamedResourceTypeIndex, deleteAll, writeDocumentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dspace.discovery.indexobject.factory.DSpaceObjectIndexFactory
storeCommunityCollectionLocationsMethods inherited from interface org.dspace.discovery.indexobject.factory.IndexFactory
deleteAll
-
Field Details
-
VARIANTS_STORE_SEPARATOR
- See Also:
-
STORE_SEPARATOR
- See Also:
-
STATUS_FIELD
- See Also:
-
STATUS_FIELD_PREDB
- See Also:
-
handleService
-
itemService
-
choiceAuthorityService
-
authorityValueService
-
metadataAuthorityService
-
workspaceItemService
-
xmlWorkflowItemService
-
workflowItemIndexFactory
-
workspaceItemIndexFactory
-
versionHistoryService
-
-
Constructor Details
-
ItemIndexFactoryImpl
public ItemIndexFactoryImpl()
-
-
Method Details
-
findAll
Description copied from interface:IndexFactoryRetrieve all instances of a certain indexable object type- Specified by:
findAllin interfaceIndexFactory<IndexableItem,Item> - Parameters:
context- DSpace context object- Returns:
- An iterator containing all the objects to be indexed for the indexable object
- Throws:
SQLException- If database error
-
getType
Description copied from interface:IndexFactoryReturn the type of the indexable object- Specified by:
getTypein interfaceIndexFactory<IndexableItem,Item> - Returns:
- a string containing the type
-
buildDocument
public org.apache.solr.common.SolrInputDocument buildDocument(Context context, IndexableItem indexableItem) throws SQLException, IOException Build a Solr document for a DSpace Item and write the index- Specified by:
buildDocumentin interfaceIndexFactory<IndexableItem,Item> - Overrides:
buildDocumentin classDSpaceObjectIndexFactoryImpl<IndexableItem,Item> - Parameters:
context- Users ContextindexableItem- The IndexableItem Item to be indexed- Returns:
- initialized solr document
- Throws:
SQLException- if database errorIOException- if IO error
-
buildNewDocument
public org.apache.solr.common.SolrInputDocument buildNewDocument(Context context, IndexableItem indexableItem) throws SQLException, IOException Description copied from interface:IndexFactoryCreate solr document with all the shared fields initialized. Can contain special fields required for "new" documents vs regular buildDocument- Specified by:
buildNewDocumentin interfaceIndexFactory<IndexableItem,Item> - Overrides:
buildNewDocumentin classIndexFactoryImpl<IndexableItem,Item> indexableItem- the indexableObject that we want to index- Returns:
- initialized solr document
- Throws:
SQLExceptionIOException
-
addDiscoveryFields
public void addDiscoveryFields(org.apache.solr.common.SolrInputDocument doc, Context context, Item item, List<DiscoveryConfiguration> discoveryConfigurations) throws SQLException, IOException Description copied from interface:ItemIndexFactoryStore item fields in the solr document- Specified by:
addDiscoveryFieldsin interfaceItemIndexFactory- Parameters:
doc- Solr input document which will be written to our discovery solr corecontext- DSpace context objectitem- Item for which we want to index our fields in the provided solr documentdiscoveryConfigurations- The discovery configuration which holds information for which item fields we should index- Throws:
SQLException- If database errorIOException- If IO error
-
writeDocument
public void writeDocument(Context context, IndexableItem indexableObject, org.apache.solr.common.SolrInputDocument solrInputDocument) throws SQLException, IOException, org.apache.solr.client.solrj.SolrServerException Description copied from interface:IndexFactoryWrite the provided document to the solr core- Specified by:
writeDocumentin interfaceIndexFactory<IndexableItem,Item> - Overrides:
writeDocumentin classIndexFactoryImpl<IndexableItem,Item> - Parameters:
context- DSpace context objectindexableObject- The indexable object that we want to store in the search coresolrInputDocument- Solr input document which will be written to our discovery search core- Throws:
SQLException- If database errorIOException- If IO errororg.apache.solr.client.solrj.SolrServerException- If the solr document could not be written to the search core
-
getLocations
public List<String> getLocations(Context context, IndexableItem indexableDSpaceObject) throws SQLException Description copied from interface:DSpaceObjectIndexFactoryReturn a list of the identifiers from the parents for the provided IndexableObject, communities will be prepended by "m", collections b "c"- Specified by:
getLocationsin interfaceDSpaceObjectIndexFactory<IndexableItem,Item> - Parameters:
context- DSpace context object- Returns:
- A list of community identifiers with "m" prepended to every one
- Throws:
SQLException- If database error
-
delete
public void delete(IndexableItem indexableObject) throws IOException, org.apache.solr.client.solrj.SolrServerException Description copied from interface:IndexFactoryRemove the provided indexable object from the solr core- Specified by:
deletein interfaceIndexFactory<IndexableItem,Item> - Overrides:
deletein classIndexFactoryImpl<IndexableItem,Item> - Parameters:
indexableObject- The indexable object that we want to remove from the search core- Throws:
IOException- If IO errororg.apache.solr.client.solrj.SolrServerException- If the solr document could not be removed to the search core
-
delete
public void delete(String indexableObjectIdentifier) throws IOException, org.apache.solr.client.solrj.SolrServerException Description copied from interface:IndexFactoryRemove the provided indexable object from the solr core- Specified by:
deletein interfaceIndexFactory<IndexableItem,Item> - Overrides:
deletein classIndexFactoryImpl<IndexableItem,Item> - Parameters:
indexableObjectIdentifier- The identifier that we want to remove from the search core- Throws:
IOException- If IO errororg.apache.solr.client.solrj.SolrServerException- If the solr document could not be removed to the search core
-
supports
Description copied from interface:IndexFactoryDetermine whether the class can handle the factory implementation- Specified by:
supportsin interfaceIndexFactory<IndexableItem,Item> - Parameters:
object- The object which we want to check- Returns:
- True if the factory implementation can handle the given object. False if it doesn't.
-
getIndexableObjects
Description copied from interface:IndexFactoryRetrieve all the indexable objects for the provided object- Specified by:
getIndexableObjectsin interfaceIndexFactory<IndexableItem,Item> - Parameters:
context- DSpace context objectitem- The object we want to retrieve our indexable objects for- Returns:
- A list of indexable objects
- Throws:
SQLException- If database error
-
findIndexableObject
Description copied from interface:IndexFactoryRetrieve a single indexable object using the provided identifier- Specified by:
findIndexableObjectin interfaceIndexFactory<IndexableItem,Item> - Parameters:
context- DSpace context objectid- The identifier for which we want to retrieve our indexable object- Returns:
- An indexable object
- Throws:
SQLException- If database error
-