[ 
https://issues.apache.org/jira/browse/JCR-3402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13559683#comment-13559683
 ] 

Cédric Damioli commented on JCR-3402:
-------------------------------------

you're obviously right with my current patch ;)

But if we go ahead with your proposal, what if we simply write (ignoring 
offset):

            numResults = -1;
            if (resultNodes.size() < maxResultSize) {
                numResults = resultNodes.size();
            }

the getTotalSize() become :

    public int getTotalSize() {
       return numResults;
    }

In this case, the numResults value is either -1 or the good value. It cannot 
shrink over time as before.
                
> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to