use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration in project jackrabbit-oak by apache.
the class TestUtils method createSolrServer.
public static SolrClient createSolrServer() {
try {
File file = new File(TestUtils.class.getResource(SOLR_HOME_PATH).toURI());
EmbeddedSolrServerConfiguration configuration = new EmbeddedSolrServerConfiguration(file.getAbsolutePath(), "oak");
EmbeddedSolrServerProvider provider = new EmbeddedSolrServerProvider(configuration);
return provider.getSolrServer();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration in project jackrabbit-oak by apache.
the class FullTextSolrSearchTest method createEmbeddedSolrServerProvider.
private EmbeddedSolrServerProvider createEmbeddedSolrServerProvider(boolean http) throws Exception {
String tempDirectoryPath = FileUtils.getTempDirectoryPath();
File solrHome = new File(tempDirectoryPath, "solr" + System.nanoTime());
EmbeddedSolrServerConfiguration embeddedSolrServerConfiguration = new EmbeddedSolrServerConfiguration(solrHome.getAbsolutePath(), "oak");
if (http) {
embeddedSolrServerConfiguration = embeddedSolrServerConfiguration.withHttpConfiguration("/solr", 8983);
}
EmbeddedSolrServerProvider embeddedSolrServerProvider = embeddedSolrServerConfiguration.getProvider();
SolrClient solrServer = embeddedSolrServerProvider.getSolrServer();
if (storageEnabled != null && !storageEnabled) {
// change schema.xml and reload the core
File schemaXML = new File(solrHome.getAbsolutePath() + "/oak/conf", "schema.xml");
InputStream inputStream = getClass().getResourceAsStream("/solr/oak/conf/schema.xml");
String schemaString = IOUtils.toString(inputStream).replace("<dynamicField name=\"*\" type=\"text_general\" indexed=\"true\" stored=\"true\" multiValued=\"true\"/>", "<dynamicField name=\"*\" type=\"text_general\" indexed=\"true\" stored=\"false\" multiValued=\"true\"/>");
FileOutputStream fileOutputStream = new FileOutputStream(schemaXML);
IOUtils.copy(new StringReader(schemaString), fileOutputStream);
fileOutputStream.flush();
((EmbeddedSolrServer) solrServer).getCoreContainer().reload("oak");
}
return embeddedSolrServerProvider;
}
Aggregations