jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r618589 - in /jackrabbit/branches/1.4/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
Date Tue, 05 Feb 2008 09:45:11 GMT
Author: jukka
Date: Tue Feb  5 01:45:01 2008
New Revision: 618589

URL: http://svn.apache.org/viewvc?rev=618589&view=rev
Log:
1.4: Merged revision 613221 (JCR-1323)

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java?rev=618589&r1=618588&r2=618589&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/QueryResultImpl.java
Tue Feb  5 01:45:01 2008
@@ -411,11 +411,11 @@
          * nodes or the session does not have access to a node.
          */
         public long getSize() {
-            int totalSize = getTotalSize();
-            if (limit > 0 && totalSize > limit) {
+            long size = getTotalSize() - offset;
+            if (limit > 0 && size > limit) {
                 return limit;
             } else {
-                return totalSize - offset;
+                return size;
             }
         }
 

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java?rev=618589&r1=618588&r2=618589&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/LimitAndOffsetTest.java
Tue Feb  5 01:45:01 2008
@@ -63,6 +63,10 @@
         return (QueryImpl) queryManager.createQuery(xpath, Query.XPATH);
     }
 
+    protected void checkResult(QueryResult result, Node[] expectedNodes) throws RepositoryException
{
+        assertEquals(expectedNodes.length, result.getNodes().getSize());
+    }
+    
     public void testLimit() throws Exception {
         query.setLimit(1);
         QueryResult result = query.execute();
@@ -111,6 +115,12 @@
         query.setLimit(2);
         result = query.execute();
         checkResult(result, new Node[] { node1, node2 });
+
+        // Added for JCR-1323
+        query.setOffset(0);
+        query.setLimit(4);
+        result = query.execute();
+        checkResult(result, new Node[] { node1, node2, node3 });
     }
 
     public void testOffsetAndSkip() throws Exception {



Mime
View raw message