jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1517768 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java
Date Tue, 27 Aug 2013 09:48:28 GMT
Author: alexparvulescu
Date: Tue Aug 27 09:48:27 2013
New Revision: 1517768

URL: http://svn.apache.org/r1517768
Log:
OAK-828 Full-text support for index aggregates


Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java?rev=1517768&r1=1517767&r2=1517768&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
Tue Aug 27 09:48:27 2013
@@ -133,15 +133,20 @@ public class FullTextSearchImpl extends 
         builder.append(')');
         return builder.toString();
     }
-    
+
     @Override
     public Set<PropertyExistenceImpl> getPropertyExistenceConditions() {
         if (propertyName == null) {
             return Collections.emptySet();
         }
+        // makes no sense in applying a property existence constrain when that
+        // property is on a different node
+        if (relativePath != null) {
+            return Collections.emptySet();
+        }
         return Collections.singleton(new PropertyExistenceImpl(selector, selectorName, propertyName));
     }
-    
+
     @Override
     public FullTextExpression getFullTextConstraint(SelectorImpl s) {
         if (s != selector) {

Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java?rev=1517768&r1=1517767&r2=1517768&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexAggregationTest.java
Tue Aug 27 09:48:27 2013
@@ -41,6 +41,8 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Test;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 public class LuceneIndexAggregationTest extends AbstractQueryTest {
 
@@ -74,9 +76,9 @@ public class LuceneIndexAggregationTest 
      * 
      */
     private static NodeAggregator getNodeAggregator() {
-        return new SimpleNodeAggregator()
-            .newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT, JCR_CONTENT + "/*"))
-            .newRuleWithName(NT_FOLDER, newArrayList("myFile"));
+        return new SimpleNodeAggregator().newRuleWithName(NT_FILE,
+                newArrayList(JCR_CONTENT, JCR_CONTENT + "/*")).newRuleWithName(
+                NT_FOLDER, newArrayList("myFile"));
     }
 
     /**
@@ -221,6 +223,9 @@ public class LuceneIndexAggregationTest 
 
         String matchNone = " //element(*, nt:folder)[(jcr:contains(myFile, 'invalid') or
jcr:contains(myFile/@jcr:title, 'invalid') or jcr:contains(myFile/@jcr:description, 'invalid'))]";
         assertQuery(matchNone, "xpath", new ArrayList<String>());
+
+        String matchOnlyTitleOr = " //element(*, nt:folder)[(jcr:contains(myFile/@jcr:title,
'title') or jcr:contains(myFile/@jcr:title, 'unknown') )]";
+        assertQuery(matchOnlyTitleOr, "xpath", ImmutableList.of("/myFolder"));
     }
 
 }



Mime
View raw message