Package org.dspace.statistics

Examples of org.dspace.statistics.SolrLogger$ResultProcessor


    public static void main(String[] args) throws Exception
    {

        DSpace dspace = new DSpace();

        SolrLogger indexer = dspace.getServiceManager().getServiceByName(
                SolrLogger.class.getName(), SolrLogger.class);

        CommandLineParser parser = new PosixParser();

        Options options = new Options();

        options.addOption("u", "update-spider-files", false,
                "Update Spider IP Files from internet into "
                        + ConfigurationManager.getProperty("dspace.dir")
                        + "/config/spiders");

        options.addOption("m", "mark-spiders", false,
                "Update isBog Flag in Solr");
        options.addOption("f", "delete-spiders-by-flag", false,
                "Delete Spiders in Solr By isBot Flag");
        options.addOption("i", "delete-spiders-by-ip", false,
                "Delete Spiders in Solr By IP Address");
        options.addOption("h", "help", false, "help");
        options.addOption("b", "mark-spiders-by-useragent", true,
                "Update isBot Flag in Solr By User Agent");
        CommandLine line = parser.parse(options, args);

        // Did the user ask to see the help?
        if (line.hasOption('h'))
        {
            printHelp(options, 0);
        }

        if (line.hasOption("u"))
        {
            // StatisticsClient.updateSpiderFiles();
        }
        else if (line.hasOption('m'))
        {
            indexer.markRobotsByIP();
        }
        else if (line.hasOption('f'))
        {
            indexer.deleteRobotsByIsBotFlag();
        }
        else if (line.hasOption('i'))
        {
            indexer.deleteRobotsByIP();
        }
        else if (line.hasOption('b'))
        {
            if (line.getOptionValue('b') != null)
                indexer.markRobotByUserAgent(line.getOptionValue('b'));
        }
        else
        {
            printHelp(options, 0);
        }
View Full Code Here


    public static void main(String[] args) throws SolrServerException,
            IOException, SQLException
    {
        DSpace dspace = new DSpace();

        SolrLogger indexer = dspace.getServiceManager().getServiceByName(SolrLogger.class.getName(),SolrLogger.class);

       
        SolrDocumentList sdl = indexer.getRawData(Constants.ITEM);
        System.out.println("Found " + sdl.getNumFound()
                + " access in the statistics core");
        HttpSolrServer solr = indexer.getSolr();
        indexer.deleteByType(Constants.ITEM);
        solr.commit();
        System.out.println("Remove old data");
        Context context = new Context();
        context.turnOffAuthorisationSystem();
        int i = 0;
        for (SolrDocument sd : sdl)
        {
            i++;
            System.out.println("Processed access #" + i + " of "
                    + sdl.getNumFound());
            SolrInputDocument sdi = ClientUtils.toSolrInputDocument(sd);
            Integer id = (Integer) sd.getFieldValue("id");
            Integer type = (Integer) sd.getFieldValue("type");

            DSpaceObject dso = DSpaceObject.find(context, type, id);
           
            // Do any additional indexing, depends on the plugins
            List<SolrStatsIndexPlugin> solrServiceIndexPlugins = new DSpace()
                    .getServiceManager().getServicesByType(
                            SolrStatsIndexPlugin.class);
            for (SolrStatsIndexPlugin solrServiceIndexPlugin : solrServiceIndexPlugins)
            {
                solrServiceIndexPlugin.additionalIndex(null, dso,
                        sdi);
            }

           
            context.removeCached(dso, id);
            solr.add(sdi);
        }
        solr.commit();
        solr.optimize();

        sdl = indexer.getRawData(CrisConstants.RP_TYPE_ID);
        System.out.println("Found " + sdl.getNumFound()
                + " access in the RP statistics core");
        HttpSolrServer rpsolr = indexer.getSolr();
        indexer.deleteByType(CrisConstants.RP_TYPE_ID);
        rpsolr.commit();

        System.out.println("Remove old data");
       
        ApplicationService as = dspace.getServiceManager().getServiceByName(
View Full Code Here

TOP

Related Classes of org.dspace.statistics.SolrLogger$ResultProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.