jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1540260 - in /jackrabbit/oak/trunk/oak-solr-core/src: main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/ main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/ test/java/org/apache/jackrabbit/oak/plugins/index/solr/
Date Sat, 09 Nov 2013 06:28:01 GMT
Author: tommaso
Date: Sat Nov  9 06:28:01 2013
New Revision: 1540260

URL: http://svn.apache.org/r1540260
Log:
OAK-1162 - make solr index async by default

Modified:
    jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/SolrIndexEditorProviderService.java
    jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/SolrIndexInitializer.java
    jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java

Modified: jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/SolrIndexEditorProviderService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/SolrIndexEditorProviderService.java?rev=1540260&r1=1540259&r2=1540260&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/SolrIndexEditorProviderService.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/osgi/SolrIndexEditorProviderService.java
Sat Nov  9 06:28:01 2013
@@ -26,7 +26,6 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.plugins.index.IndexEditor;
 import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider;
 import org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider;

Modified: jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/SolrIndexInitializer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/SolrIndexInitializer.java?rev=1540260&r1=1540259&r2=1540260&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/SolrIndexInitializer.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/util/SolrIndexInitializer.java
Sat Nov  9 06:28:01 2013
@@ -30,14 +30,37 @@ public class SolrIndexInitializer implem
 
     private static final String SOLR_IDX = "solr";
 
+    private final String async;
+
+    /**
+     * build Solr index definition with defaults (reindex enabled, asynchronous):
+     */
+    public SolrIndexInitializer() {
+        this.async = "async";
+    }
+
+    /**
+     * build Solr index definition by specifying if it should be async or not
+     * 
+     * @param async
+     *            if <code>true</code> for the index to be asynchronous, <code>false</code>
to make
+     *            it synchronous
+     */
+    public SolrIndexInitializer(boolean async) {
+        this.async = async ? "async" : null;
+    }
+
     @Override
     public void initialize(@Nonnull NodeBuilder builder) {
         if (builder.hasChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)
                 && !builder.getChildNode(IndexConstants.INDEX_DEFINITIONS_NAME).hasChildNode(SOLR_IDX))
{
             builder = builder.getChildNode(IndexConstants.INDEX_DEFINITIONS_NAME).child(SOLR_IDX);
             builder.setProperty(JcrConstants.JCR_PRIMARYTYPE, IndexConstants.INDEX_DEFINITIONS_NODE_TYPE)
-                   .setProperty(IndexConstants.TYPE_PROPERTY_NAME, "solr")
+                   .setProperty(IndexConstants.TYPE_PROPERTY_NAME, SOLR_IDX)
                    .setProperty(IndexConstants.REINDEX_PROPERTY_NAME, "true");
+            if (async != null) {
+                builder.setProperty(IndexConstants.ASYNC_PROPERTY_NAME, async);
+            }
 
         }
     }

Modified: jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java?rev=1540260&r1=1540259&r2=1540260&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
(original)
+++ jackrabbit/oak/trunk/oak-solr-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/solr/SolrBaseTest.java
Sat Nov  9 06:28:01 2013
@@ -60,7 +60,7 @@ public abstract class SolrBaseTest {
                 new SolrIndexEditorProvider(provider, provider)));
         Oak oak = new Oak().with(new InitialContent())
                 .with(new OpenSecurityProvider())
-                .with(new SolrIndexInitializer())
+                .with(new SolrIndexInitializer(false)) // synchronous
                 .with(new SolrQueryIndexProvider(provider, provider))
                 .with(new SolrIndexEditorProvider(provider, provider));
         repository = oak



Mime
View raw message