Author: chetanm
Date: Thu Sep 15 07:20:39 2016
New Revision: 1760867

URL: http://svn.apache.org/viewvc?rev=1760867&view=rev
Log:
OAK-4412 - Lucene hybrid index

Switch to constants from IndexingConstants

Modified:
    
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/TestUtil.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
    
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/NRTIndexTest.java

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
 Thu Sep 15 07:20:39 2016
@@ -79,6 +79,8 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.commons.PathUtils.getParentPath;
 import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.DECLARING_NODE_TYPES;
 import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.ENTRY_COUNT_PROPERTY_NAME;
+import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEXING_MODE_NRT;
+import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEXING_MODE_SYNC;
 import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_PATH;
 import static 
org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_COUNT;
 import static 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.*;
@@ -1580,15 +1582,15 @@ public final class IndexDefinition imple
     }
 
     private static boolean supportsNRTIndexing(NodeState defn) {
-        return supportsIndexingMode(new ReadOnlyBuilder(defn), "nrt");
+        return supportsIndexingMode(new ReadOnlyBuilder(defn), 
INDEXING_MODE_NRT);
     }
 
     private static boolean supportsSyncIndexing(NodeState defn) {
-        return supportsIndexingMode(new ReadOnlyBuilder(defn), "sync");
+        return supportsIndexingMode(new ReadOnlyBuilder(defn), 
INDEXING_MODE_SYNC);
     }
 
     public static boolean supportsSyncOrNRTIndexing(NodeBuilder defn) {
-       return supportsIndexingMode(defn, "nrt") || supportsIndexingMode(defn, 
"sync");
+       return supportsIndexingMode(defn, INDEXING_MODE_NRT) || 
supportsIndexingMode(defn, INDEXING_MODE_SYNC);
     }
 
     private static boolean supportsIndexingMode(NodeBuilder defn, String mode) 
{
@@ -1596,7 +1598,6 @@ public final class IndexDefinition imple
         if (async == null){
             return false;
         }
-        //TODO [hybrid] make it a constant
         return Iterables.contains(async.getValue(Type.STRINGS), mode);
     }
 

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
 Thu Sep 15 07:20:39 2016
@@ -29,6 +29,7 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
 import 
org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition.IndexingRule;
+import 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.IndexingMode;
 import org.apache.jackrabbit.oak.plugins.index.lucene.util.TokenizerChain;
 import org.apache.jackrabbit.oak.plugins.tree.TreeFactory;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -869,14 +870,14 @@ public class IndexDefinitionTest {
 
     @Test
     public void nrt() throws Exception{
-        TestUtil.enableNRTIndexing(builder);
+        TestUtil.enableIndexingMode(builder, IndexingMode.NRT);
         IndexDefinition idxDefn = new IndexDefinition(root, 
builder.getNodeState());
         assertTrue(idxDefn.isNRTIndexingEnabled());
     }
 
     @Test
     public void sync() throws Exception{
-        TestUtil.enableIndexingMode(builder, 
LuceneIndexConstants.IndexingMode.SYNC);
+        TestUtil.enableIndexingMode(builder, IndexingMode.SYNC);
         IndexDefinition idxDefn = new IndexDefinition(root, 
builder.getNodeState());
         assertFalse(idxDefn.isNRTIndexingEnabled());
         assertTrue(idxDefn.isSyncIndexingEnabled());

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProviderTest.java
 Thu Sep 15 07:20:39 2016
@@ -28,6 +28,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
 import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
 import org.apache.jackrabbit.oak.plugins.index.IndexingContext;
+import 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.IndexingMode;
 import org.apache.jackrabbit.oak.spi.commit.CommitContext;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.Editor;
@@ -119,7 +120,7 @@ public class LuceneIndexEditorProviderTe
     private NodeState createIndexDefinition(String idxName) {
         NodeBuilder idx = 
newLucenePropertyIndexDefinition(builder.child("oak:index"),
                 idxName, ImmutableSet.of("foo"), "async");
-        TestUtil.enableNRTIndexing(idx);
+        TestUtil.enableIndexingMode(idx, IndexingMode.NRT);
         LuceneIndexEditorContext.configureUniqueId(idx);
         IndexDefinition.updateDefinition(idx);
         return idx.getNodeState();

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/TestUtil.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/TestUtil.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/TestUtil.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/TestUtil.java
 Thu Sep 15 07:20:39 2016
@@ -223,16 +223,6 @@ public class TestUtil {
         }
     }
 
-    public static NodeBuilder enableNRTIndexing(NodeBuilder builder){
-        builder.setProperty(createAsyncProperty("nrt"));
-        return builder;
-    }
-
-    public static Tree enableNRTIndexing(Tree tree){
-        tree.setProperty(createAsyncProperty("nrt"));
-        return tree;
-    }
-
     public static NodeBuilder enableIndexingMode(NodeBuilder builder, 
IndexingMode indexingMode){
         builder.setProperty(createAsyncProperty(indexingMode));
         return builder;

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/HybridIndexTest.java
 Thu Sep 15 07:20:39 2016
@@ -130,7 +130,7 @@ public class HybridIndexTest extends Abs
     public void hybridIndex() throws Exception{
         String idxName = "hybridtest";
         Tree idx = createIndex(root.getTree("/"), idxName, 
Collections.singleton("foo"));
-        TestUtil.enableNRTIndexing(idx);
+        TestUtil.enableIndexingMode(idx, IndexingMode.NRT);
         root.commit();
 
         //Get initial indexing done as local indexing only work
@@ -166,7 +166,7 @@ public class HybridIndexTest extends Abs
     public void noTextExtractionForSyncCommit() throws Exception{
         String idxName = "hybridtest";
         Tree idx = TestUtil.createFulltextIndex(root.getTree("/"), idxName);
-        TestUtil.enableNRTIndexing(idx);
+        TestUtil.enableIndexingMode(idx, IndexingMode.NRT);
         root.commit();
 
         runAsyncIndex();

Modified: 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/NRTIndexTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/NRTIndexTest.java?rev=1760867&r1=1760866&r2=1760867&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/NRTIndexTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/hybrid/NRTIndexTest.java
 Thu Sep 15 07:20:39 2016
@@ -26,6 +26,7 @@ import java.util.List;
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
 import org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier;
 import org.apache.jackrabbit.oak.plugins.index.lucene.IndexDefinition;
+import 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.IndexingMode;
 import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorContext;
 import org.apache.jackrabbit.oak.plugins.index.lucene.TestUtil;
 import org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReader;
@@ -171,7 +172,7 @@ public class NRTIndexTest {
 
     private IndexDefinition getSyncIndexDefinition(String indexPath) {
         builder.setProperty(IndexConstants.INDEX_PATH, indexPath);
-        TestUtil.enableNRTIndexing(builder);
+        TestUtil.enableIndexingMode(builder, IndexingMode.NRT);
 
         return new IndexDefinition(root, builder.getNodeState());
     }


Reply via email to