You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2017/10/03 05:09:28 UTC
svn commit: r1810643 - in /jackrabbit/oak/trunk/oak-lucene/src:
main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java
test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
Author: chetanm
Date: Tue Oct 3 05:09:28 2017
New Revision: 1810643
URL: http://svn.apache.org/viewvc?rev=1810643&view=rev
Log:
OAK-6535 - Synchronous Lucene Property Indexes
If 'sync' property is enabled then 'propertyIndex' is always enabled
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinitionTest.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java?rev=1810643&r1=1810642&r2=1810643&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/PropertyDefinition.java Tue Oct 3 05:09:28 2017
@@ -139,8 +139,6 @@ public class PropertyDefinition {
this.analyzed = getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_ANALYZED, false);
}
- //If node is not set for full text then a property definition indicates that definition is for property index
- this.propertyIndex = getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_PROPERTY_INDEX, false);
this.ordered = getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_ORDERED, false);
this.includedPropertyTypes = IndexDefinition.getSupportedTypes(defn, LuceneIndexConstants.PROP_INCLUDED_TYPE,
IndexDefinition.TYPES_ALLOW_ALL);
@@ -162,6 +160,9 @@ public class PropertyDefinition {
this.valuePattern = new ValuePattern(defn);
this.unique = getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_UNIQUE, false);
this.sync = unique || getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_SYNC, false);
+
+ //If some property is set to sync then propertyIndex mode is always enabled
+ this.propertyIndex = sync || getOptionalValueIfIndexed(defn, LuceneIndexConstants.PROP_PROPERTY_INDEX, false);
validate();
}
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=1810643&r1=1810642&r2=1810643&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 Tue Oct 3 05:09:28 2017
@@ -980,17 +980,28 @@ public class IndexDefinitionTest {
@Test
public void uniqueIsSync() throws Exception{
IndexDefinitionBuilder defnb = new IndexDefinitionBuilder();
- defnb.indexRule("nt:base").property("foo").propertyIndex().unique();
+ defnb.indexRule("nt:base").property("foo").unique();
IndexDefinition defn = IndexDefinition.newBuilder(root, defnb.build(), "/foo").build();
assertTrue(defn.getApplicableIndexingRule("nt:base").getConfig("foo").sync);
assertTrue(defn.getApplicableIndexingRule("nt:base").getConfig("foo").unique);
+ assertTrue(defn.getApplicableIndexingRule("nt:base").getConfig("foo").propertyIndex);
+ }
+
+ @Test
+ public void syncIsProperty() throws Exception{
+ IndexDefinitionBuilder defnb = new IndexDefinitionBuilder();
+ defnb.indexRule("nt:base").property("foo").sync();
+
+ IndexDefinition defn = IndexDefinition.newBuilder(root, defnb.build(), "/foo").build();
+ assertTrue(defn.getApplicableIndexingRule("nt:base").getConfig("foo").sync);
+ assertTrue(defn.getApplicableIndexingRule("nt:base").getConfig("foo").propertyIndex);
}
@Test
public void syncPropertyDefinitions() throws Exception{
IndexDefinitionBuilder defnb = new IndexDefinitionBuilder();
- defnb.indexRule("nt:base").property("foo").propertyIndex().sync();
+ defnb.indexRule("nt:base").property("foo").sync();
IndexDefinition defn = IndexDefinition.newBuilder(root, defnb.build(), "/foo").build();
assertTrue(defn.hasSyncPropertyDefinitions());