|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for retrieving the results of a search request. This interface is more specialized to data model searches than the standard Collection interface. The interface is structured so that implementing classes may employ more efficient streaming algorithms, whereby the implementing classes may stream results in from the datastore in parallel to a client's processing of the returned results. The key is in the exception/error handling portion of the interface, where errors that may be encountered at any point in the data retrieval can be deferred to the entry that caused the error, allowing for best effort retrieval of data, instead of a rigid all or nothing approach. If an error is detected at any point in the retrieval of data, however, the current contents of the object will stay in tact, but no other results will be obtained from the data store.
Users should note that a SearchResults instance may hold on to
system resources such as data store connections or cursors. It
is recommended that each instance be explicitly closed, preferably
within a try/finally block to guarantee that resources are returned
to the system. For example:
SearchResults results = null;
try {
results = ...;
...
}
finally {
if (results != null)
results.close();
}
SearchResultsIterator
,
SearchResultsStatus
Method Summary | |
---|---|
void |
clear()
Clears the current contents, cancels the search, and closes any live connection to the data store, freeing up any resources allocated to that connection. |
void |
close()
Cancels the search, and closes any live connection to the data store, freeing up any resources allocated to that connection. |
boolean |
equals(java.lang.Object o)
Overrides the Object.equals behavior, returning true if the objects both hold the same results. |
SearchResultsStatus |
getStatus()
Returns the final status of the search. |
boolean |
isClosed()
Is the result set closed? |
boolean |
isEmpty()
Returns whether there are any results. |
boolean |
isSorted()
Is the result set sorted? |
SearchResultsIterator |
iterator()
Returns an iterator over the elements in this collection. |
int |
size()
Returns the number of results returned. |
int |
size(SearchResultsStatus status)
Returns the number of results returned. |
java.util.Collection |
toCollection()
Returns the results returned as a Collection. |
java.util.Collection |
toCollection(SearchResultsStatus status)
Returns the results returned as a Collection. |
Method Detail |
public void clear()
public void close()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object to compare (must be a SearchResults).
public boolean isEmpty() throws PartialResultsException
PartialResultsException
- Thrown if an error was detected
trying to determine if a result was obtained from the data
store.public boolean isSorted() throws PartialResultsException
PartialResultsException
public boolean isClosed() throws PartialResultsException
PartialResultsException
public SearchResultsIterator iterator()
public int size() throws PartialResultsException
PartialResultsException
- Thrown if an error was detected
trying to retrieve all results from the data store, most
likely to a size limit threshold violation.public int size(SearchResultsStatus status)
status
- SearchResultsStatus to fill with the final status of the search.
If an error was detected, the details will be provided
here. This parameter is optional, if not provided (null),
no status will be returned.
public java.util.Collection toCollection() throws PartialResultsException
PartialResultsException
- Thrown if an error was detected
trying to retrieve all results from the data store, most
likely to a size limit threshold violation.public java.util.Collection toCollection(SearchResultsStatus status)
status
- SearchResultsStatus to fill with the final status of the search.
If an error was detected, the details will be provided
here. This parameter is optional, if not provided (null),
no status will be returned.
public SearchResultsStatus getStatus()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |