Interface IndexFactory<T extends IndexableObject,S>
-
- All Known Subinterfaces:
ClaimedTaskIndexFactory,CollectionIndexFactory,CommunityIndexFactory,DSpaceObjectIndexFactory<T,S>,InprogressSubmissionIndexFactory<T,S>,ItemIndexFactory,MetadataFieldIndexFactory,PoolTaskIndexFactory,WorkflowItemIndexFactory,WorkspaceItemIndexFactory
- All Known Implementing Classes:
ClaimedTaskIndexFactoryImpl,CollectionIndexFactoryImpl,CommunityIndexFactoryImpl,DSpaceObjectIndexFactoryImpl,IndexFactoryImpl,InprogressSubmissionIndexFactoryImpl,ItemIndexFactoryImpl,MetadataFieldIndexFactoryImpl,PoolTaskIndexFactoryImpl,WorkflowItemIndexFactoryImpl,WorkspaceItemIndexFactoryImpl
public interface IndexFactory<T extends IndexableObject,S>Basis factory interface for indexing/retrieving any IndexableObject in the search core- Author:
- Kevin Van de Velde (kevin at atmire dot com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.solr.common.SolrInputDocumentbuildDocument(Context context, T indexableObject)Create solr document with all the shared fields initialized.voiddelete(String indexableObjectIdentifier)Remove the provided indexable object from the solr corevoiddelete(T indexableObject)Remove the provided indexable object from the solr corevoiddeleteAll()Remove all indexable objects of the implementing type from the search coreIterator<T>findAll(Context context)Retrieve all instances of a certain indexable object typeOptional<T>findIndexableObject(Context context, String id)Retrieve a single indexable object using the provided identifierListgetIndexableObjects(Context context, S object)Retrieve all the indexable objects for the provided objectStringgetType()Return the type of the indexable objectbooleansupports(Object object)Determine whether the class can handle the factory implementationvoidwriteDocument(Context context, T indexableObject, org.apache.solr.common.SolrInputDocument solrInputDocument)Write the provided document to the solr core
-
-
-
Method Detail
-
findAll
Iterator<T> findAll(Context context) throws SQLException
Retrieve all instances of a certain indexable object type- 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
String getType()
Return the type of the indexable object- Returns:
- a string containing the type
-
buildDocument
org.apache.solr.common.SolrInputDocument buildDocument(Context context, T indexableObject) throws SQLException, IOException
Create solr document with all the shared fields initialized.- Parameters:
indexableObject- the indexableObject that we want to index- Returns:
- initialized solr document
- Throws:
SQLExceptionIOException
-
writeDocument
void writeDocument(Context context, T indexableObject, org.apache.solr.common.SolrInputDocument solrInputDocument) throws SQLException, IOException, org.apache.solr.client.solrj.SolrServerException
Write the provided document to the solr core- 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
-
delete
void delete(T indexableObject) throws IOException, org.apache.solr.client.solrj.SolrServerException
Remove the provided indexable object from the solr core- 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
void delete(String indexableObjectIdentifier) throws IOException, org.apache.solr.client.solrj.SolrServerException
Remove the provided indexable object from the solr core- 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
-
deleteAll
void deleteAll() throws IOException, org.apache.solr.client.solrj.SolrServerExceptionRemove all indexable objects of the implementing type 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
-
findIndexableObject
Optional<T> findIndexableObject(Context context, String id) throws SQLException
Retrieve a single indexable object using the provided identifier- 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
-
supports
boolean supports(Object object)
Determine whether the class can handle the factory implementation- 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
List getIndexableObjects(Context context, S object) throws SQLException
Retrieve all the indexable objects for the provided object- 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
-
-