jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1504114 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/ oak-jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/ oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/
Date Wed, 17 Jul 2013 13:11:31 GMT
Author: thomasm
Date: Wed Jul 17 13:11:31 2013
New Revision: 1504114

URL: http://svn.apache.org/r1504114
Log:
OAK-890 Query: advanced fulltext search conditions

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/FullTextSearchImpl.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.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=1504114&r1=1504113&r2=1504114&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
Wed Jul 17 13:11:31 2013
@@ -64,11 +64,17 @@ public class FullTextSearchImpl extends 
             propertyName = propertyName.substring(slash + 1);
         }
 
+        // temporary workaround to support using an index for
+        // "contains(a/*, 'x') or contains(a/a, x') or contains(a/b, 'x')"
+        // TODO this behavior does not match the specification
+        propertyName = null;
+
         if (propertyName == null || "*".equals(propertyName)) {
             this.propertyName = null;
         } else {
             this.propertyName = propertyName;
         }
+        
         this.fullTextSearchExpression = fullTextSearchExpression;
     }
 
@@ -91,14 +97,11 @@ public class FullTextSearchImpl extends 
         if (propertyName == null) {
             propertyName = "*";
         }
+        
         if (relativePath != null) {
             propertyName = relativePath + "/" + propertyName;
         }
         
-        // temporary workaround to support using an index for
-        // "contains(*, 'x') or contains(a, x') or contains(b, 'x')"
-        // propertyName = "*";
-        
         builder.append(quote(propertyName));
         builder.append(", ");
         builder.append(getFullTextSearchExpression());

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1504114&r1=1504113&r2=1504114&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Jul 17 13:11:31 2013
@@ -314,6 +314,8 @@
       org.apache.jackrabbit.core.query.DerefTest#testRewrite                            
            <!-- OAK-321 -->
       org.apache.jackrabbit.core.query.DerefTest#testDerefToVersionNode                 
            <!-- OAK-321 -->
       org.apache.jackrabbit.core.query.DerefTest#testMultipleDeref                      
            <!-- OAK-321 -->
+      org.apache.jackrabbit.core.query.FulltextQueryTest#testContainsPropScopeSQL    <!--
OAK-902 -->
+      org.apache.jackrabbit.core.query.FulltextQueryTest#testContainsPropScopeXPath    <!--
OAK-902 -->
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex0Descendant               
            <!-- OAK-322 -->
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex1Descendant               
            <!-- OAK-322 -->
       org.apache.jackrabbit.core.query.XPathAxisTest#testIndex2Descendant               
            <!-- OAK-322 -->

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java?rev=1504114&r1=1504113&r2=1504114&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
Wed Jul 17 13:11:31 2013
@@ -42,7 +42,7 @@ public class QueryFulltextTest extends A
     }
     
     @Test
-    public void fulltext() throws Exception {
+    public void fulltextOrWithinText() throws Exception {
         Session session = getAdminSession();
         QueryManager qm = session.getWorkspace().getQueryManager();
         Node testRootNode = session.getRootNode().addNode("testroot");
@@ -61,7 +61,7 @@ public class QueryFulltextTest extends A
         
         q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
         assertEquals("[nt:base] as [nt:base] /* traverse \"*\" " + 
-                "where contains([nt:base].[text], cast('hello OR hallo' as string)) */",

+                "where contains([nt:base].[*], cast('hello OR hallo' as string)) */", 
                 getResult(q.execute(), "plan"));
         
         // verify the result

Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java?rev=1504114&r1=1504113&r2=1504114&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryFulltextTest.java
Wed Jul 17 13:11:31 2013
@@ -50,8 +50,8 @@ public class QueryFulltextTest extends A
         Query q;
         
         q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
-        assertEquals("[nt:base] as [nt:base] /* +text:{* TO *} +(+:fulltext:hello +:fulltext:or
+:fulltext:hallo) " + 
-                "where contains([nt:base].[text], cast('hello OR hallo' as string)) */",

+        assertEquals("[nt:base] as [nt:base] /* +:fulltext:hello +:fulltext:or +:fulltext:hallo
" + 
+                "where contains([nt:base].[*], cast('hello OR hallo' as string)) */", 
                 getResult(q.execute(), "plan"));
         
         // verify the result



Mime
View raw message