Package org.apache.solr.core

Examples of org.apache.solr.core.CoreContainer$Initializer


    private EmbeddedSolrServer startSolr(String home) throws Exception {
        try {
            SolrConfig solrConfig = new SolrConfig(home, SOLR_CONFIG, null);
            IndexSchema schema = new IndexSchema(solrConfig, SOLR_SCHEMA, null);

            solrContainer = new CoreContainer(new SolrResourceLoader(
                    SolrResourceLoader.locateSolrHome()));
            CoreDescriptor descriptor = new CoreDescriptor(solrContainer, "",
                    solrConfig.getResourceLoader().getInstanceDir());
            descriptor.setConfigName(solrConfig.getResourceName());
            descriptor.setSchemaName(schema.getResourceName());
View Full Code Here


    static final String SOLR_HOME_PATH = "target/test-classes/solr";
    static final String SOLRCONFIG_PATH = "target/test-classes/solr/solr.xml";

    public static SolrServer createSolrServer() {
        CoreContainer coreContainer = new CoreContainer(SOLR_HOME_PATH);
        try {
            coreContainer.load(SOLR_HOME_PATH, new File(SOLRCONFIG_PATH));
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
        return new EmbeddedSolrServer(coreContainer, "oak");
    }
View Full Code Here

            } else {
                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(CoreContainer.class.getClassLoader());

                CoreContainer coreContainer = new CoreContainer(solrHomePath);
                try {
                    coreContainer.load(solrHomePath, new File(solrConfigPath));
                } finally {
                    Thread.currentThread().setContextClassLoader(classLoader);
                }

                EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, coreName);
View Full Code Here

    static final String SOLR_HOME_PATH = "target/test-classes/solr";
    static final String SOLRCONFIG_PATH = "target/test-classes/solr/solr.xml";

    public static SolrServer createSolrServer() {
        CoreContainer coreContainer = new CoreContainer(SOLR_HOME_PATH);
        try {
            coreContainer.load(SOLR_HOME_PATH, new File(SOLRCONFIG_PATH));
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
        return new EmbeddedSolrServer(coreContainer, "oak");
    }
View Full Code Here

                return httpSolrServer;
            } else {
                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(CoreContainer.class.getClassLoader());

                CoreContainer coreContainer = new CoreContainer(solrHomePath);
                try {
                    coreContainer.load(solrHomePath, new File(solrConfigPath));
                } finally {
                    Thread.currentThread().setContextClassLoader(classLoader);
                }

                EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, coreName);
View Full Code Here

    static final String SOLR_HOME_PATH = "/solr";
    static final String SOLRCONFIG_PATH = "/solr/solr.xml";

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

                return httpSolrServer;
            } else {
                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                Thread.currentThread().setContextClassLoader(CoreContainer.class.getClassLoader());

                CoreContainer coreContainer = new CoreContainer(solrHomePath);
                try {
                    coreContainer.load(solrHomePath, new File(solrConfigPath));
                } finally {
                    Thread.currentThread().setContextClassLoader(classLoader);
                }

                EmbeddedSolrServer server = new EmbeddedSolrServer(coreContainer, coreName);
View Full Code Here

    }
    CoreDescriptor dcore = core.getCoreDescriptor();
    if (dcore == null)
      throw new NullPointerException("CoreDescriptor required");
   
    CoreContainer cores = dcore.getCoreContainer();
    if (cores == null)
      throw new NullPointerException("CoreContainer required");
   
    coreName = dcore.getName();
    coreContainer = cores;
View Full Code Here

      instanceDir = SolrResourceLoader.locateInstanceDir();
    }
   
    // Initialize
    try {
      CoreContainer cores = new CoreContainer(new SolrResourceLoader(instanceDir));
      SolrConfig solrConfig = new SolrConfig(instanceDir, SolrConfig.DEFAULT_CONF_FILE, null);
      CoreDescriptor dcore = new CoreDescriptor(cores, "", solrConfig.getResourceLoader().getInstanceDir());
      IndexSchema indexSchema = new IndexSchema(solrConfig, instanceDir+"/conf/schema.xml", null);
      core = new SolrCore( null, dataDir, solrConfig, indexSchema, dcore);
      cores.register("", core, false);
      parser = new SolrRequestParsers( solrConfig );
    }
    catch (Exception ee) {
      throw new RuntimeException(ee);
    }
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

TOP

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

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.