Interface IndexFactory<T extends IndexableObject,​S>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.apache.solr.common.SolrInputDocument buildDocument​(Context context, T indexableObject)
      Create solr document with all the shared fields initialized.
      void delete​(String indexableObjectIdentifier)
      Remove the provided indexable object from the solr core
      void delete​(T indexableObject)
      Remove the provided indexable object from the solr core
      void deleteAll()
      Remove all indexable objects of the implementing type from the search core
      Iterator<T> findAll​(Context context)
      Retrieve all instances of a certain indexable object type
      Optional<T> findIndexableObject​(Context context, String id)
      Retrieve a single indexable object using the provided identifier
      List getIndexableObjects​(Context context, S object)
      Retrieve all the indexable objects for the provided object
      String getType()
      Return the type of the indexable object
      boolean supports​(Object object)
      Determine whether the class can handle the factory implementation
      void writeDocument​(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:
        SQLException
        IOException
      • 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 object
        indexableObject - The indexable object that we want to store in the search core
        solrInputDocument - Solr input document which will be written to our discovery search core
        Throws:
        SQLException - If database error
        IOException - If IO error
        org.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 error
        org.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 error
        org.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.SolrServerException
        Remove all indexable objects of the implementing type from the search core
        Throws:
        IOException - If IO error
        org.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 object
        id - 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 object
        object - The object we want to retrieve our indexable objects for
        Returns:
        A list of indexable objects
        Throws:
        SQLException - If database error