Package org.apache.solr.client.solrj.impl

Examples of org.apache.solr.client.solrj.impl.HttpSolrServer


       
        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(
                "applicationService", ApplicationService.class);
        i = 0;
        for (SolrDocument sd : sdl)
        {
            i++;
            System.out.println("Processed RP access #" + i + " of "
                    + sdl.getNumFound());
            SolrInputDocument sdi = ClientUtils.toSolrInputDocument(sd);
            Integer id = (Integer) sd.getFieldValue("id");

            ResearcherPage rp = as.get(ResearcherPage.class, id);
            if (rp == null)
                continue;

            // Do any additional indexing, depends on the plugins
            List<SolrStatsIndexPlugin> solrServiceIndexPlugins = new DSpace()
                    .getServiceManager().getServicesByType(
                            SolrStatsIndexPlugin.class);
            for (SolrStatsIndexPlugin solrServiceIndexPlugin : solrServiceIndexPlugins)
            {
                solrServiceIndexPlugin.additionalIndex(null, rp,
                        sdi);
            }
          
            rpsolr.add(sdi);
        }
        rpsolr.commit();
        rpsolr.optimize();
    }
View Full Code Here


    String serverProperty = ConfigurationManager.getProperty(NetworkPlugin.CFG_MODULE,"network.server");
        log.info("network.server:"
        + serverProperty);

    HttpSolrServer server = null;

    if (serverProperty != null) {
      try {
        server = new HttpSolrServer(
                serverProperty);


      } catch (Exception e) {
        log.error(e.getMessage(), e);
View Full Code Here

                    JettySolrRunner jettySolrRunner = new JettySolrRunner(solrHomePath, context, httpPort, "solrconfig.xml", "schema.xml", true);
                    jettySolrRunner.start(true);
                } finally {
                    Thread.currentThread().setContextClassLoader(classLoader);
                }
                HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(SolrServerConfigurationDefaults.LOCAL_BASE_URL)
                        .append(':').append(httpPort).append(coreName).toString());
                if (OakSolrUtils.checkServerAlive(httpSolrServer)) {
                    return httpSolrServer;
                } else {
                    throw new IOException("the spawn HTTP Solr server is not alive");
View Full Code Here

        return solrServer;
    }

    private SolrServer initializeWithExistingHttpServer() throws IOException, SolrServerException {
        // try basic Solr HTTP client
        HttpSolrServer httpSolrServer = new HttpSolrServer(solrHttpUrl);
        if (OakSolrUtils.checkServerAlive(httpSolrServer)) {
            // TODO : check if the oak core exists, otherwise create it
            return httpSolrServer;
        } else {
            throw new IOException("the found HTTP Solr server is not alive");
View Full Code Here

        if (solrServer == null) {
            String url = new StringBuilder(SolrServerConfigurationDefaults.LOCAL_BASE_URL)
                            .append(':').append(SolrServerConfigurationDefaults.HTTP_PORT)
                            .append(SolrServerConfigurationDefaults.CONTEXT).append('/')
                            .append(SolrServerConfigurationDefaults.CORE_NAME).toString();
            solrServer = new HttpSolrServer(url);
        }
        return solrServer;
    }
View Full Code Here

                    Thread.currentThread().setContextClassLoader(classLoader);
                }
                if (log.isInfoEnabled()) {
                    log.info("starting HTTP Solr server");
                }
                HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(
                        SolrServerConfigurationDefaults.LOCAL_BASE_URL).append(':')
                        .append(httpPort).append(context).append('/').append(coreName)
                        .toString());
                return httpSolrServer;
            } else {
View Full Code Here

  public void init() {
    try {
      String url = searchConfigRetriever.getSearchUrl();
      url = url.substring(0, url.indexOf("/select"));
      //logger.info(url);
      HttpSolrServer httpServer = new HttpSolrServer(url);
        // Note that the following property could be set through JVM level arguments too
        /*System.setProperty("solr.solr.home", "/home/shalinsmangar/work/oss/branch-1.3/example/solr");
        CoreContainer.Initializer initializer = new CoreContainer.Initializer();
        CoreContainer coreContainer = initializer.initialize();
        EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, "");*/
     
      httpServer.setParser(new XMLResponseParser());
      this.solrServer = (SolrServer) httpServer;
     
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

        SolrClientHolder solrClientHolder = solrClientHolderCache.get(storeName);
        if(null == solrClientHolder.getSolrClient()){
            lock.lock();
            try{
                if(null == solrClientHolder.getSolrClient()){
                    HttpSolrServer solrClient = new HttpSolrServer(solrClientHolder.getSolrUrl());
                    initSolrClient(solrClient);
                    solrClientHolder.setSolrClient(solrClient);
                }
            }finally{
                lock.unlock();
View Full Code Here

                    Thread.currentThread().setContextClassLoader(classLoader);
                }
                if (log.isInfoEnabled()) {
                    log.info("starting HTTP Solr server");
                }
                HttpSolrServer httpSolrServer = new HttpSolrServer(new StringBuilder(
                        SolrServerConfigurationDefaults.LOCAL_BASE_URL).append(':')
                        .append(httpPort).append(context).append('/').append(coreName)
                        .toString());
                return httpSolrServer;
            } else {
View Full Code Here

        return solrServer;
    }

    private SolrServer initializeWithExistingHttpServer() throws IOException, SolrServerException {
        // try basic Solr HTTP client
        HttpSolrServer httpSolrServer = new HttpSolrServer(solrHttpUrl);
        SolrPingResponse ping = httpSolrServer.ping();
        if (ping != null && 0 == ping.getStatus()) {
            return httpSolrServer;
        } else {
            throw new IOException("the found HTTP Solr server is not alive");
        }
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.impl.HttpSolrServer

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.