jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1441498 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: query/Query.java query/index/FilterImpl.java spi/query/Filter.java
Date Fri, 01 Feb 2013 15:57:52 GMT
Author: alexparvulescu
Date: Fri Feb  1 15:57:52 2013
New Revision: 1441498

URL: http://svn.apache.org/viewvc?rev=1441498&view=rev
Log:
OAK-600 Query log tweaks

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/FilterImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Filter.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java?rev=1441498&r1=1441497&r2=1441498&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Query.java
Fri Feb  1 15:57:52 2013
@@ -75,7 +75,7 @@ public class Query {
      */
     public static final String JCR_SCORE = "jcr:score";
 
-    private static final Logger LOG = LoggerFactory.getLogger(QueryEngineImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(Query.class);
 
     final SourceImpl source;
     final String statement;
@@ -317,7 +317,8 @@ public class Query {
             it = Arrays.asList(r).iterator();
         } else {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("plan: " + getPlan());
+                LOG.debug("query execute {} ", statement);
+                LOG.debug("query plan {}", getPlan());
             }
             if (orderings == null) {
                 // can apply limit and offset directly

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/FilterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/FilterImpl.java?rev=1441498&r1=1441497&r2=1441498&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/FilterImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/index/FilterImpl.java
Fri Feb  1 15:57:52 2013
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.query.
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map.Entry;
 
@@ -273,17 +274,29 @@ public class FilterImpl implements Filte
 
     @Override
     public String toString() {
+        if (alwaysFalse) {
+            return "Filter(always false)";
+        }
         StringBuilder buff = new StringBuilder();
+        buff.append("Filter(");
         if (queryStatement != null) {
-            buff.append("query ").append(queryStatement).append('\n');
-        }
-        if (alwaysFalse) {
-            return "(always false)";
+            buff.append("query=").append(queryStatement);
         }
-        buff.append("path: ").append(path).append(pathRestriction).append('\n');
-        for (Entry<String, PropertyRestriction> p : propertyRestrictions.entrySet())
{
-            buff.append("property ").append(p.getKey()).append(": ").append(p.getValue()).append('\n');
+        buff.append(", path=").append(path).append(pathRestriction);
+        if (!propertyRestrictions.isEmpty()) {
+            buff.append(", property=[");
+            Iterator<Entry<String, PropertyRestriction>> iterator = propertyRestrictions
+                    .entrySet().iterator();
+            while (iterator.hasNext()) {
+                Entry<String, PropertyRestriction> p = iterator.next();
+                buff.append(p.getKey()).append("=").append(p.getValue());
+                if (iterator.hasNext()) {
+                    buff.append(", ");
+                }
+            }
+            buff.append("]");
         }
+        buff.append(")");
         return buff.toString();
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Filter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Filter.java?rev=1441498&r1=1441497&r2=1441498&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Filter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Filter.java
Fri Feb  1 15:57:52 2013
@@ -144,8 +144,13 @@ public interface Filter {
 
         @Override
         public String toString() {
-            return (first == null ? "" : ((firstIncluding ? "[" : "(") + first)) + ".." +
-                    (last == null ? "" : last + (lastIncluding ? "]" : ")"));
+            String f = first == null ? "" : first.toString();
+            String l = last == null ? "" : last.toString();
+            if (f.equals(l)) {
+                return f;
+            }
+            return (firstIncluding ? "[" : "(") + f + ".." + l
+                    + (lastIncluding ? "]" : ")");
         }
 
     }



Mime
View raw message