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
Fields Modifier and Type Field Description protected ChoiceAuthorityServicechoiceAuthorityServiceprotected HandleServicehandleServiceprotected ItemServiceitemServiceprotected MetadataAuthorityServicemetadataAuthorityServicestatic StringSTORE_SEPARATORstatic StringVARIANTS_STORE_SEPARATORprotected WorkflowItemIndexFactoryworkflowItemIndexFactoryprotected WorkspaceItemIndexFactoryworkspaceItemIndexFactoryprotected WorkspaceItemServiceworkspaceItemServiceprotected XmlWorkflowItemServicexmlWorkflowItemService-
Fields inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
solrSearchCore, solrServiceIndexPlugins
-
-
Constructor Summary
Constructors Constructor Description ItemIndexFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDiscoveryFields(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 indexvoiddelete(String indexableObjectIdentifier)Remove the provided indexable object from the solr corevoiddelete(IndexableItem indexableObject)Remove the provided indexable object from the solr coreIterator<IndexableItem>findAll(Context context)Retrieve all instances of a certain indexable object typeOptional<IndexableItem>findIndexableObject(Context context, String id)Retrieve a single indexable object using the provided identifierListgetIndexableObjects(Context context, Item object)Retrieve all the indexable objects for the provided objectList<String>getLocations(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"StringgetType()Return the type of the indexable objectbooleansupports(Object object)Determine 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 core-
Methods inherited from class org.dspace.discovery.indexobject.DSpaceObjectIndexFactoryImpl
addContainerMetadataField, storeCommunityCollectionLocations
-
Methods inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
addFacetIndex, addFacetIndex, addNamedResourceTypeIndex, deleteAll, writeDocument
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.discovery.indexobject.factory.DSpaceObjectIndexFactory
storeCommunityCollectionLocations
-
Methods inherited from interface org.dspace.discovery.indexobject.factory.IndexFactory
deleteAll
-
-
-
-
Field Detail
-
VARIANTS_STORE_SEPARATOR
public static final String VARIANTS_STORE_SEPARATOR
- See Also:
- Constant Field Values
-
STORE_SEPARATOR
public static final String STORE_SEPARATOR
- See Also:
- Constant Field Values
-
handleService
@Autowired protected HandleService handleService
-
itemService
@Autowired protected ItemService itemService
-
choiceAuthorityService
@Autowired(required=true) protected ChoiceAuthorityService choiceAuthorityService
-
metadataAuthorityService
@Autowired protected MetadataAuthorityService metadataAuthorityService
-
workspaceItemService
@Autowired protected WorkspaceItemService workspaceItemService
-
xmlWorkflowItemService
@Autowired protected XmlWorkflowItemService xmlWorkflowItemService
-
workflowItemIndexFactory
@Autowired protected WorkflowItemIndexFactory workflowItemIndexFactory
-
workspaceItemIndexFactory
@Autowired protected WorkspaceItemIndexFactory workspaceItemIndexFactory
-
-
Method Detail
-
findAll
public Iterator<IndexableItem> findAll(Context context) throws SQLException
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
public String 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
-
addDiscoveryFields
public void addDiscoveryFields(org.apache.solr.common.SolrInputDocument doc, Context context, Item item, List<DiscoveryConfiguration> discoveryConfigurations) throws SQLException, IOExceptionDescription 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
public boolean supports(Object object)
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
public List getIndexableObjects(Context context, Item object) throws SQLException
Description copied from interface:IndexFactoryRetrieve all the indexable objects for the provided object- Specified by:
getIndexableObjectsin interfaceIndexFactory<IndexableItem,Item>- Parameters:
context- DSpace context objectobject- The object we want to retrieve our indexable objects for- Returns:
- A list of indexable objects
- Throws:
SQLException- If database error
-
findIndexableObject
public Optional<IndexableItem> findIndexableObject(Context context, String id) throws SQLException
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
-
-