Author: chetanm
Date: Mon Jan 4 10:32:35 2016
New Revision: 1722832
URL: http://svn.apache.org/viewvc?rev=1722832&view=rev
Log:
OAK-3831 - Allow relative property to be indexed but excluded from aggregation
Made exclusion criteria more specific i.e. only nodeScopeIndex=false property
would be excluded from aggregation which is inline with the intended use of
nodeScopeIndex config
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java?rev=1722832&r1=1722831&r2=1722832&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
Mon Jan 4 10:32:35 2016
@@ -827,7 +827,7 @@ public class LuceneIndexEditor implement
//Check if any explicit property defn is defined via relative path
// and is marked to exclude this property from being indexed
PropertyDefinition pdForRootNode =
indexingRule.getConfig(propertyPath);
- if (pdForRootNode != null && !pdForRootNode.index) {
+ if (pdForRootNode != null && !pdForRootNode.nodeScopeIndex) {
continue;
}
Modified:
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java?rev=1722832&r1=1722831&r2=1722832&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LucenePropertyIndexTest.java
Mon Jan 4 10:32:35 2016
@@ -1707,7 +1707,8 @@ public class LucenePropertyIndexTest ext
Tree prop1 = props.addChild(TestUtil.unique("prop"));
prop1.setProperty(LuceneIndexConstants.PROP_NAME,
"original/jcr:content/type");
- prop1.setProperty(LuceneIndexConstants.PROP_INDEX, false);
+ prop1.setProperty(LuceneIndexConstants.PROP_NODE_SCOPE_INDEX, false);
+ prop1.setProperty(LuceneIndexConstants.PROP_PROPERTY_INDEX, true);
newNodeAggregator(idx)
.newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT,
JCR_CONTENT + "/*"))
@@ -1727,6 +1728,10 @@ public class LucenePropertyIndexTest ext
assertQuery("select [jcr:path] from [oak:TestNode] where contains(*,
'hello')", asList("/test/a"));
assertQuery("select [jcr:path] from [oak:TestNode] where contains(*,
'image')", asList("/test/a"));
assertQuery("select [jcr:path] from [oak:TestNode] where contains(*,
'jpg')", Collections.<String>emptyList());
+
+ //Check that property index is being used
+ assertThat(explain("select [jcr:path] from [oak:TestNode] where
[original/jcr:content/type] = 'foo'"),
+ containsString("original/jcr:content/type:foo"));
}
@Test