Search in sources :

Example 1 with SolrIndexEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider 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);
    }
}
Also used : DefaultSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.DefaultSolrServerProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) DefaultSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)

Example 2 with SolrIndexEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider 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);
    }
}
Also used : DefaultSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.DefaultSolrServerProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) DefaultSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)

Example 3 with SolrIndexEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider 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));
}
Also used : EmbeddedSolrServerConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration) DefaultSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider) OakSolrConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration) SolrIndexInitializer(org.apache.jackrabbit.oak.plugins.index.solr.util.SolrIndexInitializer) SolrServer(org.apache.solr.client.solrj.SolrServer) IOException(java.io.IOException) RepositoryException(javax.jcr.RepositoryException) OakSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider) EmbeddedSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.EmbeddedSolrServerProvider) SolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider) SolrQueryIndexProvider(org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider) EmbeddedSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.EmbeddedSolrServerProvider) NodeStateSolrServersObserver(org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServersObserver) DefaultSolrConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfiguration) File(java.io.File) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)

Example 4 with SolrIndexEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider in project jackrabbit-oak by apache.

the class SolrBaseTest method setUp.

@Before
public void setUp() throws Exception {
    store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
    provider = new TestUtils();
    server = provider.getSolrServer();
    configuration = provider.getConfiguration();
    hook = new EditorHook(new IndexUpdateProvider(new SolrIndexEditorProvider(provider, provider)));
    Oak oak = new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(// synchronous
    new SolrIndexInitializer(false)).with(new SolrQueryIndexProvider(provider, provider)).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(provider, provider));
    repository = oak.createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) IndexUpdateProvider(org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider) SolrQueryIndexProvider(org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider) NodeStateSolrServersObserver(org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServersObserver) EditorHook(org.apache.jackrabbit.oak.spi.commit.EditorHook) Oak(org.apache.jackrabbit.oak.Oak) SolrIndexInitializer(org.apache.jackrabbit.oak.plugins.index.solr.util.SolrIndexInitializer) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider) Before(org.junit.Before)

Aggregations

SolrIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)4 InitialContent (org.apache.jackrabbit.oak.InitialContent)3 Oak (org.apache.jackrabbit.oak.Oak)3 DefaultSolrConfigurationProvider (org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider)3 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)3 NodeStateSolrServersObserver (org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServersObserver)2 SolrQueryIndexProvider (org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndexProvider)2 DefaultSolrServerProvider (org.apache.jackrabbit.oak.plugins.index.solr.server.DefaultSolrServerProvider)2 SolrIndexInitializer (org.apache.jackrabbit.oak.plugins.index.solr.util.SolrIndexInitializer)2 File (java.io.File)1 IOException (java.io.IOException)1 RepositoryException (javax.jcr.RepositoryException)1 IndexUpdateProvider (org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider)1 DefaultSolrConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfiguration)1 EmbeddedSolrServerConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.EmbeddedSolrServerConfiguration)1 OakSolrConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration)1 OakSolrConfigurationProvider (org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider)1 EmbeddedSolrServerProvider (org.apache.jackrabbit.oak.plugins.index.solr.server.EmbeddedSolrServerProvider)1 SolrServerProvider (org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider)1 MemoryStore (org.apache.jackrabbit.oak.segment.memory.MemoryStore)1