jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@adobe.com>
Subject Re: The infamous getSize() == -1 (Was: [jira] [Created] (OAK-300) Query: QueryResult.getRows().getSize())
Date Tue, 11 Sep 2012 22:07:32 GMT
On 11.09.2012, at 07:18, Thomas Mueller <mueller@adobe.com> wrote:

>> 2. The client does need to know the size, so it calls getSize() and
> 
> I currently can't come up with a convincing use case - what is your use
> case?

Display the actual number of search results to the user?

>> has to iterate through all results if getSize() returns -1.
> 
> I would add: clients that do call getSize() even thought they don't really
> need the result, or don't care so much about the result, and only use it
> to display a 'next page' button / adjust the scrollbar.

If they show "next page", they usually also show the number of results and the number of pages.

>> PS. Note that implementing an "estimated size" feature like seen in
>> many public search engines ("results 1-10 of thousands") is really
>> difficult to implement in a manner that's both efficient and secure.
> 
> I agree.

In many cases the paging etc. doesn't have to be exact, so if there is a way that Oak could
provide a fairly good estimate that would be really cool (like caching the numbers).

Cheers,
Alex


Mime
View raw message