Cédric Damioli (JIRA | 3 Aug 2012 12:09
Picon
Favicon

[Created] (JCR-3402) getSize() returning too many often -1

Cédric Damioli created JCR-3402:
-----------------------------------

             Summary: getSize() returning too many often -1
                 Key: JCR-3402
                 URL: https://issues.apache.org/jira/browse/JCR-3402
             Project: Jackrabbit Content Repository
          Issue Type: Improvement
            Reporter: Cédric Damioli

I've came accross the well known behaviour of query results returning -1 when asked for getSize().

While this is ok for optimization reasons (lazy results fetching), I just discovered that the default
"resultFetchSize" value in lucene queries is Integer.MAX_VALUE, so in all queries I've ever executed,
all results were actually fetched before asking for getSize, so IMHO nothing prevents getSize() to
return the real value instead -1

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

Cédric Damioli (JIRA | 3 Aug 2012 12:11
Picon
Favicon

[Updated] (JCR-3402) getSize() returning too many often -1


     [
https://issues.apache.org/jira/browse/JCR-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cédric Damioli updated JCR-3402:
--------------------------------

    Attachment: QueryResultImpl.java.patch

Attached is a proposal that aims to return the real size instead of -1 in certain cases.

All tests pass with this patch, but unfortunately there's not many tests testing for getSize()

It would be great if a query expert could review this small patch to see if I haven't broken anything
Thanks

> getSize() returning too many often -1
> -------------------------------------
>
>                 Key: JCR-3402
>                 URL: https://issues.apache.org/jira/browse/JCR-3402
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Cédric Damioli
>         Attachments: QueryResultImpl.java.patch
>
>
> I've came accross the well known behaviour of query results returning -1 when asked for getSize().
> While this is ok for optimization reasons (lazy results fetching), I just discovered that the default
"resultFetchSize" value in lucene queries is Integer.MAX_VALUE, so in all queries I've ever executed,
(Continue reading)

Cédric Damioli (JIRA | 3 Aug 2012 12:11
Picon
Favicon

[Updated] (JCR-3402) getSize() returning too many often -1


     [
https://issues.apache.org/jira/browse/JCR-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cédric Damioli updated JCR-3402:
--------------------------------

    Status: Patch Available  (was: Open)

> getSize() returning too many often -1
> -------------------------------------
>
>                 Key: JCR-3402
>                 URL: https://issues.apache.org/jira/browse/JCR-3402
>             Project: Jackrabbit Content Repository
>          Issue Type: Improvement
>            Reporter: Cédric Damioli
>         Attachments: QueryResultImpl.java.patch
>
>
> I've came accross the well known behaviour of query results returning -1 when asked for getSize().
> While this is ok for optimization reasons (lazy results fetching), I just discovered that the default
"resultFetchSize" value in lucene queries is Integer.MAX_VALUE, so in all queries I've ever executed,
all results were actually fetched before asking for getSize, so IMHO nothing prevents getSize() to
return the real value instead -1

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
(Continue reading)


Gmane