use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider in project jackrabbit-oak by apache.
the class SubtreeSolrIndexIT method createRepository.
@Override
protected ContentRepository createRepository() {
try {
DefaultSolrServerProvider solrServerProvider = new DefaultSolrServerProvider();
DefaultSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider();
return new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider)).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider)).createContentRepository();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider in project jackrabbit-oak by apache.
the class SolrIndexIT method createRepository.
@Override
protected ContentRepository createRepository() {
try {
DefaultSolrServerProvider solrServerProvider = new DefaultSolrServerProvider();
DefaultSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider();
return new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider)).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider)).createContentRepository();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider in project jackrabbit-oak by apache.
the class SolrOakRepositoryStub method preCreateRepository.
@Override
protected void preCreateRepository(Jcr jcr) {
String path = getClass().getResource("/").getFile() + "/queryjcrtest";
File f = new File(path);
final SolrServer solrServer;
try {
solrServer = new EmbeddedSolrServerProvider(new EmbeddedSolrServerConfiguration(f.getPath(), "oak")).getSolrServer();
} catch (Exception e) {
throw new RuntimeException();
}
SolrServerProvider solrServerProvider = new SolrServerProvider() {
@Override
public void close() throws IOException {
}
@CheckForNull
@Override
public SolrServer getSolrServer() throws Exception {
return solrServer;
}
@Override
public SolrServer getIndexingSolrServer() throws Exception {
return solrServer;
}
@Override
public SolrServer getSearchingSolrServer() throws Exception {
return solrServer;
}
};
try {
// safely remove any previous document on the index
solrServer.deleteByQuery("*:*");
solrServer.commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
OakSolrConfiguration configuration = new DefaultSolrConfiguration() {
@Nonnull
@Override
public CommitPolicy getCommitPolicy() {
return CommitPolicy.HARD;
}
};
OakSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider(configuration);
jcr.with(new SolrIndexInitializer(false)).with(AggregateIndexProvider.wrap(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider))).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider));
}
Aggregations