Interface SolrLoggerService

  • All Known Implementing Classes:
    SolrLoggerServiceImpl

    public interface SolrLoggerService
    Static holder for a HttpSolrClient connection pool to issue usage logging events to Solr from DSpace libraries, and some static query composers.
    Author:
    ben at atmire.com, kevinvandevelde at atmire.com, mdiggory at atmire.com
    • Method Detail

      • postView

        void postView​(DSpaceObject dspaceObject,
                      javax.servlet.http.HttpServletRequest request,
                      EPerson currentUser)
        Store a usage event into Solr.
        Parameters:
        dspaceObject - the object used.
        request - the current request context.
        currentUser - the current session's user.
      • postView

        void postView​(DSpaceObject dspaceObject,
                      javax.servlet.http.HttpServletRequest request,
                      EPerson currentUser,
                      String referrer)
        Store a usage event into Solr.
        Parameters:
        dspaceObject - the object used.
        request - the current request context.
        currentUser - the current session's user.
        referrer - the optional referrer.
      • storeParents

        void storeParents​(org.apache.solr.common.SolrInputDocument doc1,
                          DSpaceObject dso)
                   throws SQLException
        Method just used to log the parents.
        • Community log: owning comms.
        • Collection log: owning comms and their comms.
        • Item log: owning colls/comms.
        • Bitstream log: owning item/colls/comms.
        Parameters:
        doc1 - the current SolrInputDocument
        dso - the current dspace object we want to log
        Throws:
        SQLException - if database error ignore it
      • isUseProxies

        boolean isUseProxies()
      • removeIndex

        void removeIndex​(String query)
                  throws IOException,
                         org.apache.solr.client.solrj.SolrServerException
        Delete data from the index, as described by a query.
        Parameters:
        query - description of the records to be deleted.
        Throws:
        IOException - A general class of exceptions produced by failed or interrupted I/O operations.
        org.apache.solr.client.solrj.SolrServerException - Exception from the Solr server to the solrj Java client.
      • markRobotsByIP

        void markRobotsByIP()
      • markRobotByUserAgent

        void markRobotByUserAgent​(String agent)
      • deleteRobotsByIsBotFlag

        void deleteRobotsByIsBotFlag()
      • deleteIP

        void deleteIP​(String ip)
      • deleteRobotsByIP

        void deleteRobotsByIP()
      • update

        void update​(String query,
                    String action,
                    List<String> fieldNames,
                    List<List<Object>> fieldValuesList,
                    boolean commit)
             throws org.apache.solr.client.solrj.SolrServerException,
                    IOException
        Update the solr core.
        Parameters:
        query - query indicating which documents to update
        action - the update action keyword
        fieldNames - the fields to update
        fieldValuesList - the values for the fields to update
        commit - whether to commit the changes
        Throws:
        org.apache.solr.client.solrj.SolrServerException
        IOException
      • query

        void query​(String query,
                   int max,
                   int facetMinCount)
            throws org.apache.solr.client.solrj.SolrServerException,
                   IOException
        Throws:
        org.apache.solr.client.solrj.SolrServerException
        IOException
      • queryFacetField

        ObjectCount[] queryFacetField​(String query,
                                      String filterQuery,
                                      String facetField,
                                      int max,
                                      boolean showTotal,
                                      List<String> facetQueries,
                                      int facetMinCount)
                               throws org.apache.solr.client.solrj.SolrServerException,
                                      IOException
        Query used to get values grouped by the given facet field.
        Parameters:
        query - the query to be used
        filterQuery - filter query
        facetField - the facet field on which to group our values
        max - the max number of values given back (in case of 10 the top 10 will be given)
        showTotal - a boolean determining whether the total amount should be given back as the last element of the array
        facetQueries - list of facet queries
        facetMinCount - Minimum count of results facet must have to return a result
        Returns:
        an array containing our results
        Throws:
        org.apache.solr.client.solrj.SolrServerException - Exception from the Solr server to the solrj Java client.
        IOException - passed through.
      • queryFacetDate

        ObjectCount[] queryFacetDate​(String query,
                                     String filterQuery,
                                     int max,
                                     String dateType,
                                     String dateStart,
                                     String dateEnd,
                                     boolean showTotal,
                                     Context context,
                                     int facetMinCount)
                              throws org.apache.solr.client.solrj.SolrServerException,
                                     IOException
        Query used to get values grouped by the date.
        Parameters:
        query - the query to be used
        filterQuery - filter query
        max - the max number of values given back (in case of 10 the top 10 will be given)
        dateType - the type to be used (example: DAY, MONTH, YEAR)
        dateStart - the start date Format:(-3, -2, ..) the date is calculated relatively on today
        dateEnd - the end date stop Format (-2, +1, ..) the date is calculated relatively on today
        showTotal - a boolean determining whether the total amount should be given back as the last element of the array
        context - The relevant DSpace Context.
        facetMinCount - Minimum count of results facet must have to return a result
        Returns:
        and array containing our results
        Throws:
        org.apache.solr.client.solrj.SolrServerException - Exception from the Solr server to the solrj Java client.
        IOException - passed through.
      • queryTotal

        ObjectCount queryTotal​(String query,
                               String filterQuery,
                               int facetMinCount)
                        throws org.apache.solr.client.solrj.SolrServerException,
                               IOException
        Throws:
        org.apache.solr.client.solrj.SolrServerException
        IOException
      • query

        org.apache.solr.client.solrj.response.QueryResponse query​(String query,
                                                                  String filterQuery,
                                                                  String facetField,
                                                                  int rows,
                                                                  int max,
                                                                  String dateType,
                                                                  String dateStart,
                                                                  String dateEnd,
                                                                  List<String> facetQueries,
                                                                  String sort,
                                                                  boolean ascending,
                                                                  int facetMinCount)
                                                           throws org.apache.solr.client.solrj.SolrServerException,
                                                                  IOException
        Perform a solr query.
        Parameters:
        query - the query to be used
        filterQuery - filter query
        facetField - field to facet the results by
        rows - the max number of results to return
        max - the max number of facets to return
        dateType - the type to be used (example: DAY, MONTH, YEAR)
        dateStart - the start date Format:(-3, -2, ..) the date is calculated relatively on today
        dateEnd - the end date stop Format (-2, +1, ..) the date is calculated relatively on today
        facetQueries - list of facet queries
        sort - the sort field
        ascending - the sort direction (true: ascending)
        facetMinCount - Minimum count of results facet must have to return a result
        Throws:
        org.apache.solr.client.solrj.SolrServerException - Exception from the Solr server to the solrj Java client.
        IOException - passed through.
      • query

        org.apache.solr.client.solrj.response.QueryResponse query​(String query,
                                                                  String filterQuery,
                                                                  String facetField,
                                                                  int rows,
                                                                  int max,
                                                                  String dateType,
                                                                  String dateStart,
                                                                  String dateEnd,
                                                                  List<String> facetQueries,
                                                                  String sort,
                                                                  boolean ascending,
                                                                  int facetMinCount,
                                                                  boolean defaultFilterQueries)
                                                           throws org.apache.solr.client.solrj.SolrServerException,
                                                                  IOException
        Perform a solr query.
        Parameters:
        query - the query to be used
        filterQuery - filter query
        facetField - field to facet the results by
        rows - the max number of results to return
        max - the max number of facets to return
        dateType - the type to be used (example: DAY, MONTH, YEAR)
        dateStart - the start date Format:(-3, -2, ..) the date is calculated relatively on today
        dateEnd - the end date stop Format (-2, +1, ..) the date is calculated relatively on today
        facetQueries - list of facet queries
        sort - the sort field
        ascending - the sort direction (true: ascending)
        facetMinCount - Minimum count of results facet must have to return a result
        defaultFilterQueries - use the default filter queries
        Throws:
        org.apache.solr.client.solrj.SolrServerException - Exception from the Solr server to the solrj Java client.
        IOException - passed through.
      • getIgnoreSpiderIPs

        String getIgnoreSpiderIPs()
        Returns in a filterQuery string all the ip addresses that should be ignored
        Returns:
        a string query with ip addresses
      • shardSolrIndex

        void shardSolrIndex()
                     throws IOException,
                            org.apache.solr.client.solrj.SolrServerException
        Throws:
        IOException
        org.apache.solr.client.solrj.SolrServerException
      • reindexBitstreamHits

        void reindexBitstreamHits​(boolean removeDeletedBitstreams)
                           throws Exception
        Throws:
        Exception
      • exportHits

        void exportHits()
                 throws Exception
        Export all SOLR usage statistics for viewing/downloading content to a flat text file. The file goes to a series
        Throws:
        Exception - if error
      • commit

        void commit()
             throws IOException,
                    org.apache.solr.client.solrj.SolrServerException
        Commit the solr core.
        Throws:
        IOException
        org.apache.solr.client.solrj.SolrServerException