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 th...@apache.org on 2013/05/13 15:26:16 UTC

svn commit: r1481841 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java

Author: thomasm
Date: Mon May 13 13:26:16 2013
New Revision: 1481841

URL: http://svn.apache.org/r1481841
Log:
OAK-816 Property index: restrictions of the type "x > 10" can be processed as "x is not null"

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java?rev=1481841&r1=1481840&r2=1481841&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java Mon May 13 13:26:16 2013
@@ -119,8 +119,8 @@ class PropertyIndex implements QueryInde
                     && pr.first != null && pr.first.equals(pr.last)) {
                     // "[property] = $value"
                     return lookup.getCost(filter, propertyName, pr.first);
-                } else if (pr.first == null && pr.last == null) {
-                    // "[property] is not null"
+                } else {
+                    // processed as "[property] is not null"
                     return lookup.getCost(filter, propertyName, null);
                 }
             }
@@ -147,8 +147,8 @@ class PropertyIndex implements QueryInde
                     // "[property] = $value"
                     paths = lookup.query(filter, propertyName, pr.first);
                     break;
-                } else if (pr.first == null && pr.last == null) {
-                    // "[property] is not null"
+                } else {
+                    // processed as "[property] is not null"
                     paths = lookup.query(filter, propertyName, null);
                     break;
                 }
@@ -167,6 +167,7 @@ class PropertyIndex implements QueryInde
     @Override
     public String getPlan(Filter filter, NodeState root) {
         StringBuilder buff = new StringBuilder("property");
+        StringBuilder notIndexed = new StringBuilder();
         PropertyIndexLookup lookup = new PropertyIndexLookup(root);
         for (PropertyRestriction pr : filter.getPropertyRestrictions()) {
             String propertyName = PathUtils.getName(pr.propertyName);
@@ -176,11 +177,19 @@ class PropertyIndex implements QueryInde
                 if (pr.firstIncluding && pr.lastIncluding
                     && pr.first != null && pr.first.equals(pr.last)) {
                     buff.append(' ').append(propertyName).append('=').append(pr.first);
-                } else if (pr.first == null && pr.last == null) {
+                } else {
                     buff.append(' ').append(propertyName);
                 }
+            } else {
+                notIndexed.append(' ').append(propertyName);
+                if (!pr.toString().isEmpty()) {
+                    notIndexed.append(':').append(pr);
+                }
             }
         }
+        if (notIndexed.length() > 0) {
+            buff.append(" (").append(notIndexed.toString().trim()).append(")");
+        }
         return buff.toString();
     }