Package org.apache.solr.core

Examples of org.apache.solr.core.CoreContainer


                    "Unable to copy default configuration for the manages Solr " +
                    "Directory to the configured path '%s'!",
                     managedSolrDir.getAbsoluteFile()), e);
            }
        }
        server = new CoreContainer(managedSolrDir.getAbsolutePath());
        File solrXml = new File(managedSolrDir,"solr.xml");
        try {
            server.load(managedSolrDir.getAbsolutePath(), solrXml);
        } catch (ParserConfigurationException e) {
            throw new IllegalStateException("Unable to initialise XML parsers for parsing 'solr.xml'",e);
View Full Code Here


        //create a clone so that only we control who changes to the properties
        serverProperties = parsedServerProperties.clone();
//        SolrResourceLoader loader = new OsgiResourceLoader(solrDir.getAbsolutePath(),
//            SolrServerAdapter.class.getClassLoader());
//        CoreContainer container = new CoreContainer(loader);
        CoreContainer container = new CoreContainer(solrDir.getAbsolutePath());
        File solrCof = new File(solrDir,parsedServerProperties.getSolrXml());
        ClassLoader classLoader = updateContextClassLoader();
        try {
            log.info(">> +++++++++++++++++++++++");
            XPathFactory.newInstance();
            log.info(">>  {}",org.xml.sax.InputSource.class.getClassLoader());
            log.info(">> +++++++++++++++++++++++");
            container.load(solrDir.getAbsolutePath(), solrCof);
        } finally {
            Thread.currentThread().setContextClassLoader(classLoader);
        }
        this.server = container;
        this.registrations = Collections.synchronizedMap(
View Full Code Here

    @Override
    public SolrServer addingService(ServiceReference reference) {
        log.info(" ... in addingService for {} (ref: {})",
            this.reference,reference);
        String coreName;
        CoreContainer server;
        Object service = super.addingService(reference);
        if(service == null){
            log.warn("addingService({}) returned null -> unable to create " +
                "EmbeddedSolrServer for IndexReference {}",reference,this.reference);
        }
View Full Code Here

    private EmbeddedSolrServerFactory() { }

    public EmbeddedSolrServer getServer() throws IOException, ParserConfigurationException, SAXException {
        if(this.server == null) {
            final CoreContainer.Initializer initializer = new CoreContainer.Initializer();
            final CoreContainer coreContainer = initializer.initialize();
            this.server = new EmbeddedSolrServer(coreContainer, "");
        }
        return this.server;
    }
View Full Code Here

                }
            }
            LOG.trace("Done printing solr.xml");
        }

        CoreContainer coreContainer = CoreContainer.createAndLoad(solrServer, solrXml);
        EmbeddedSolrServer primaryServer = new EmbeddedSolrServer(coreContainer, SolrContext.PRIMARY);
        EmbeddedSolrServer reindexServer = new EmbeddedSolrServer(coreContainer, SolrContext.REINDEX);

        SolrContext.setPrimaryServer(primaryServer);
        SolrContext.setReindexServer(reindexServer);
View Full Code Here

  @Override
  public void setUp() throws Exception {
    super.setUp();

    SolrResourceLoader loader = new SolrResourceLoader(getSolrHome());
    CoreContainer container = new CoreContainer(loader);
    CoreDescriptor descriptor = new CoreDescriptor(container, "cname", ".");
    SolrCore core = container.create(descriptor);
    container.register(core.getName(), core, false);

    solr = new EmbeddedSolrServer(container, core.getName());
  }
View Full Code Here

      } catch (MalformedURLException e) {
        throw new MorphlineRuntimeException(e);
      }
    } else {
      if (solrUrl == null && solrHomeDir != null) {
        CoreContainer coreContainer = new CoreContainer(solrHomeDir);
        coreContainer.load();
        EmbeddedSolrServer embeddedSolrServer = new EmbeddedSolrServer(coreContainer, collectionName);
        return embeddedSolrServer;
      }
      if (solrUrl == null || solrUrl.length() == 0) {
        throw new MorphlineCompilationException("Missing parameter 'solrUrl'", config);
View Full Code Here

public class SolbaseInitializer extends Initializer {

    @Override
    public CoreContainer initialize() throws IOException, ParserConfigurationException, SAXException {
                     
        CoreContainer cores = new SolbaseCoreContainer(solrConfigFilename == null ? SolrConfig.DEFAULT_CONF_FILE : solrConfigFilename);

        return cores;
    }
View Full Code Here

    static final String SOLR_HOME_PATH = "/solr";

    public static SolrServer createSolrServer() {
        String homePath = SolrServerProvider.class.getResource(SOLR_HOME_PATH).getFile();
        CoreContainer coreContainer = new CoreContainer(homePath);
        try {
            coreContainer.load();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
        return new EmbeddedSolrServer(coreContainer, "oak");
    }
View Full Code Here

      SolrResourceLoader loader = new SolrResourceLoader(solrHome.toString(), null, props);
      LOG.info(String
          .format(
              "Constructed instance information solr.home %s (%s), instance dir %s, conf dir %s, writing index to temporary directory %s, with permdir %s",
              solrHome, solrHome.toUri(), loader.getInstanceDir(), loader.getConfigDir(), dataDir, perm));
      CoreContainer container = new CoreContainer(loader);
      CoreDescriptor descr = new CoreDescriptor(container, "core1", solrHome.toString());
      descr.setDataDir(dataDir);
      descr.setCoreProperties(props);
      core = container.create(descr);
      container.register(core, false);
      solr = new EmbeddedSolrServer(container, "core1");
      batchWriter = new BatchWriter(solr, batchSize, context.getTaskAttemptID().getTaskID(), threadCount, queueSize);

      this.converter = converter;
    } catch(Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.solr.core.CoreContainer

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.