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

Thomas Mueller commented on OAK-790:
------------------------------------

What about renaming getSize() to getSizeOrUnknown()?

ResultRow.getSize() does return a value >= 0 in some cases, for example if the 
query contains "order by". But I understand for your query it always returns -1.

> drop the method from the OAK interface altogether if we are never going to 
> implement

That's not an option, as it is needed and used in oak-jcr.

> add isEmpty

That's an option, but I wonder if it is really useful right now. We could 
implement it as ResultRow.getRows().iterator().hasNext(). But in your case, as 
far as I understand, you are interested in the rows as well. I suggest we wait 
implementing isEmpty currently, until we have a case where somebody is only 
interested in the isEmpty information but not in the rows (unless that's 
already the case).
                
> ResultRow#getSize() always returns -1
> -------------------------------------
>
>                 Key: OAK-790
>                 URL: https://issues.apache.org/jira/browse/OAK-790
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>            Reporter: angela
>
> just had a failing test due to the fact that my code was 
> trying to find out if the query produce any result before
> starting to look over the result entries.
> that didn't work since ResultRow#getSize() always returned -1.
> if fixed my problem by just getting rid of ResultRow#getSize().
> i would suggest to either
> - implement getSize() for 'nothing-found' and/or a few results found
> - drop the method from the OAK interface altogether if we are never
>   going to implement
> - add #isEmpty for those cases were someone just wanted to know if a
>   query found something without the need of knowing the exact number.

--
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