Project: stp

com.ibm.rational.wvcm.stp.cq
Interface CqHitSet

All Superinterfaces:
Iterable<CqHit>, Iterator<CqHit>, StpReleasable

public interface CqHitSet
extends StpReleasable, Iterator<CqHit>, Iterable<CqHit>

The interface to the results of a CqUserDb.doFullTextSearch invocation. A CqHitSet is an Iterable, but each invocation of its iterator() method does not restart the iteration. It just continues from the last read hit. That is CqHitSet.iterator() simply returns the CqHitSet object. It is provided to allow the use of CqHitSet objects in the Java 5 for-each construct.

See Also:
CqUserDb.doFullTextSearch(com.ibm.rational.wvcm.stp.cq.CqUserDb.SearchFilter, long[])

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.rational.wvcm.stp.StpReleasable
StpReleasable.ReleaseException
 
Method Summary
 boolean doGetMore(long maxSetSize)
          Requests the server to forward the next set of hits to the client.
 String expandedSearchString()
           
 boolean hasMore()
          Indicates whether or not the server has more data to provide via the doGetMore() method.
 long nextIndex()
           
 void setAutoGetMore(boolean autoGetMore)
          Sets whether or not more hits are automatically requested from the server when those currently on the client run out.
 long size()
           
 long totalHits()
           
 
Methods inherited from interface com.ibm.rational.wvcm.stp.StpReleasable
release
 
Methods inherited from interface Iterator
hasNext, next, remove
 
Methods inherited from interface Iterable
iterator
 

Method Detail

doGetMore

boolean doGetMore(long maxSetSize)
                  throws WvcmException
Requests the server to forward the next set of hits to the client. Successful execution of this method flushes the current content of the CqHitSet iterator and resets it to the first hit of the new set, adjusting the nextIndex and size fields accordingly.

Parameters:
maxSetSize - The maximum number of hits the client will accept in the next set. If zero, the number of hits requested will be the same as previously request.
Returns:
true if more hits were obtained from the server; false if there were none left on the server.
Throws:
WvcmException - If the server had indicated it had more hits, but the attempt to get those hits from the server failed.

expandedSearchString

String expandedSearchString()
Returns:
The search string composed from the filter content and used by the search engine to generate this hit set.

hasMore

boolean hasMore()
Indicates whether or not the server has more data to provide via the doGetMore() method.

Returns:
true if the server has more hit data that it could send to the client.

nextIndex

long nextIndex()
Returns:
Amongst all hits found by the search, the ordinal position of the hit to be returned by the next call to Iterator.next(). This value can exceed totalHits() while there are still hits available. All hits have been returned only when hasNext() and hasMore() both return false.

setAutoGetMore

void setAutoGetMore(boolean autoGetMore)
Sets whether or not more hits are automatically requested from the server when those currently on the client run out.

Parameters:
autoGetMore - If false, Iterator.hasNext() will return false and Iterator.next() will throw an exception when size() returns 0 (i.e. after the last hit on the client has been returned by the Iterator.next() function). This is the initial, default behavior of any result set.

If true, Iterator.hasNext() or Iterator.next() will automatically call doGetMore() when there are no more hits on the client. In this mode the last specified value for the hit set size is used in the implicit call of doGetMore().


size

long size()
Returns:
The number of hits currently on the client that can be accessed by Iterator.next(). This value resets after each interaction with the server and thus is not monotonic.

totalHits

long totalHits()
Returns:
The total number of hits found by the search. In most cases this number is only an approximation and can be used only to give an indication of the magnitude of the hit set.

Generated Mon 2-Mar-2009 11:14 PM

Copyright © IBM 2009. All rights reserved.