org.hippoecm.hst.content.beans.query
Class HstQueryResultImpl

java.lang.Object
  extended by org.hippoecm.hst.content.beans.query.HstQueryResultImpl
All Implemented Interfaces:
HstQueryResult

public class HstQueryResultImpl
extends Object
implements HstQueryResult


Constructor Summary
HstQueryResultImpl(ObjectConverter objectConverter, javax.jcr.query.QueryResult queryResult, HstVirtualizer virtualizer)
           
 
Method Summary
 HippoBeanIterator getHippoBeans()
          This returns a HippoBeanIterator, which is a lazy loading proxy for accessing the beans in the HstQueryResult.
 int getSize()
           Returns the total number of hits.
 int getTotalSize()
           Returns the total number of hits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HstQueryResultImpl

public HstQueryResultImpl(ObjectConverter objectConverter,
                          javax.jcr.query.QueryResult queryResult,
                          HstVirtualizer virtualizer)
Method Detail

getHippoBeans

public HippoBeanIterator getHippoBeans()
Description copied from interface: HstQueryResult
This returns a HippoBeanIterator, which is a lazy loading proxy for accessing the beans in the HstQueryResult. This is really efficient as the beans are only really fetched when being called by HippoBeanIterator.nextHippoBean() or Iterator.next()

Specified by:
getHippoBeans in interface HstQueryResult
Returns:
a HippoBeanIterator

getTotalSize

public int getTotalSize()
Description copied from interface: HstQueryResult

Returns the total number of hits. This is the total size of hits, even if a HstQuery.setLimit(int) was used that was smaller. This is different then HstQueryResult.getSize(). Also this method does not imply that every hit needs to be authorized. Hence, this call is much more efficient than HstQueryResult.getSize().

The HstQueryResult.getTotalSize() will return the correct authorized size once we have tackled this in the Repository, see HREPTWO-619

Specified by:
getTotalSize in interface HstQueryResult
Returns:
the total number of authorized hits.
See Also:
HstQueryResult.getSize()

getSize

public int getSize()
Description copied from interface: HstQueryResult

Returns the total number of hits. A hit from a HstQuery is always a single hit. If the hit matches the search criteria multiple times, it still results as a single hit.

Note that when a limit is set on the query, for example through HstQuery.setLimit(int), then this method will never give a higher value then this limit. If you need the total hit number you can use HstQueryResult.getTotalSize(). You can better not set the limit to Integer.MAX_VALUE to get the actual total hits, as this means all hits need to be authorized. In that case, HstQueryResult.getTotalSize() if much faster as it does not authorize the hits.

The HstQueryResult.getTotalSize() will return the correct authorized size once we have tackled this in the Repository, see HREPTWO-619

Specified by:
getSize in interface HstQueryResult
Returns:
the total number of authorized hits.
See Also:
HstQueryResult.getTotalSize()


Copyright © 2008-2012 Hippo. All Rights Reserved.