You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Martin Zdila (JIRA)" <ji...@apache.org> on 2008/01/17 18:27:34 UTC

[jira] Created: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
---------------------------------------------------------------------------------------------------------

                 Key: JCR-1323
                 URL: https://issues.apache.org/jira/browse/JCR-1323
             Project: Jackrabbit
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: Linux, Java 6
            Reporter: Martin Zdila


When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1323:
-------------------------------

      Component/s: query
                   jackrabbit-core
    Fix Version/s:     (was: 1.5)

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core, query
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>             Fix For: 1.4.1
>
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl resolved JCR-1323.
----------------------------------

    Resolution: Invalid
      Assignee: Christoph Kiehl

This is expected behaviour as the iterator has exactly that size. To get the total number of result entries use org.apache.jackrabbit.core.query.lucene.QueryResultImpl.getTotalSize(). Please ask on the mailing list before creating issues.

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-1323:
---------------------------------

    Fix Version/s: 1.4.1

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>             Fix For: 1.4.1, 1.5
>
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Martin Zdila (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Zdila reopened JCR-1323:
-------------------------------


I think you didn't understand me completely. If I have 45 nodes, offset is 40 and limit is 20 (ie I am on the last page), then NodeIterator.getSize() should report 5 and not 20. 

final Query query = session.getWorkspace().getQueryManager().createQuery(queryString, Query.XPATH);
((QueryImpl) query).setLimit(limit);
((QueryImpl) query).setOffset(offset > 0 ? offset - 1 : offset);
NodeIterator ni = queryResult.getNodes();

System.out.println(ni.getSize()); // will print 20 and not 5 as expected

int i;
for (i = 0; ni.hasNext(); i++) {
  ni.nextNode();
}

System.out.println(i); // will print 5

Now I must use workaround:
final long totalSize = ((QueryResultImpl) queryResult).getTotalSize();
final long size = Math.min(ni.getSize(), totalSize - offset + 1);

If I am wrong again, then I apologize in advance :-)

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Martin Zdila (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560283#action_12560283 ] 

zdila edited comment on JCR-1323 at 1/18/08 12:15 AM:
-------------------------------------------------------------

I think you didn't understand me completely. If I have 45 nodes, offset is 40 and limit is 20 (ie I am on the last page), then NodeIterator.getSize() should report 5 and not 20. 

final Query query = session.getWorkspace().getQueryManager().createQuery(queryString, Query.XPATH);
((QueryImpl) query).setLimit(limit);
((QueryImpl) query).setOffset(offset);
NodeIterator ni = queryResult.getNodes();

System.out.println(ni.getSize()); // will print 20 and not 5 as expected

int i;
for (i = 0; ni.hasNext(); i++) {
  ni.nextNode();
}

System.out.println(i); // will print 5

Now I must use workaround:
final long totalSize = ((QueryResultImpl) queryResult).getTotalSize();
final long size = Math.min(ni.getSize(), totalSize - offset);

If I am wrong again, then I apologize in advance :-)

      was (Author: zdila):
    I think you didn't understand me completely. If I have 45 nodes, offset is 40 and limit is 20 (ie I am on the last page), then NodeIterator.getSize() should report 5 and not 20. 

final Query query = session.getWorkspace().getQueryManager().createQuery(queryString, Query.XPATH);
((QueryImpl) query).setLimit(limit);
((QueryImpl) query).setOffset(offset > 0 ? offset - 1 : offset);
NodeIterator ni = queryResult.getNodes();

System.out.println(ni.getSize()); // will print 20 and not 5 as expected

int i;
for (i = 0; ni.hasNext(); i++) {
  ni.nextNode();
}

System.out.println(i); // will print 5

Now I must use workaround:
final long totalSize = ((QueryResultImpl) queryResult).getTotalSize();
final long size = Math.min(ni.getSize(), totalSize - offset + 1);

If I am wrong again, then I apologize in advance :-)
  
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl resolved JCR-1323.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5

Thanks a lot for clarifying! Fixed in rev. 613221

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>             Fix For: 1.5
>
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1323) When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565678#action_12565678 ] 

Jukka Zitting commented on JCR-1323:
------------------------------------

Merged to the 1.4 branch in revision 618589.

> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-1323
>                 URL: https://issues.apache.org/jira/browse/JCR-1323
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core, query
>    Affects Versions: 1.4
>         Environment: Linux, Java 6
>            Reporter: Martin Zdila
>            Assignee: Christoph Kiehl
>             Fix For: 1.4.1
>
>
> When using QueryImpl.setLimit() and QueryImpl.setOffset(), then NodeIterator.getSize() reports wrong size. Returned size seems to be allways the same as the limit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.