Package ddf.catalog.util.impl
Class ResultIterable
java.lang.Object
ddf.catalog.util.impl.ResultIterable
- All Implemented Interfaces:
Iterable<ddf.catalog.data.Result>
Class used to iterate over the
Result objects contained in a QueryResponse returned when executing a QueryRequest. The class
will fetch new results as needed until all results that match the query provided have been
exhausted.
Since the class may use the page size provided in the Query to fetch the results, its
value should be carefully set to avoid any memory or performance issues.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionIterator<ddf.catalog.data.Result> iterator()static ResultIterableresultIterable(ddf.catalog.CatalogFramework catalogFramework, ddf.catalog.operation.QueryRequest queryRequest) Creates an iterable that will call theCatalogFrameworkto retrieve the results that match theQueryRequestprovided.static ResultIterableresultIterable(ddf.catalog.CatalogFramework catalogFramework, ddf.catalog.operation.QueryRequest queryRequest, int maxResultCount) Creates an iterable that will call theCatalogFrameworkto retrieve the results that match theQueryRequestprovided.static ResultIterableresultIterable(QueryFunction queryFunction, ddf.catalog.operation.QueryRequest queryRequest) Creates an iterable that will call aQueryFunctionto retrieve the results that match theQueryRequestprovided.static ResultIterableresultIterable(QueryFunction queryFunction, ddf.catalog.operation.QueryRequest queryRequest, int maxResultCount) Creates an iterable that will call aQueryFunctionto retrieve the results that match theQueryRequestprovided.Stream<ddf.catalog.data.Result> stream()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE- See Also:
-
-
Method Details
-
resultIterable
public static ResultIterable resultIterable(ddf.catalog.CatalogFramework catalogFramework, ddf.catalog.operation.QueryRequest queryRequest) Creates an iterable that will call theCatalogFrameworkto retrieve the results that match theQueryRequestprovided. There will be no limit to the number of results returned.- Parameters:
catalogFramework- reference to theCatalogFrameworkto call to retrieve the results.queryRequest- request used to retrieve the results.
-
resultIterable
public static ResultIterable resultIterable(QueryFunction queryFunction, ddf.catalog.operation.QueryRequest queryRequest) Creates an iterable that will call aQueryFunctionto retrieve the results that match theQueryRequestprovided. There will be no limit to the number of results returned.- Parameters:
queryFunction- reference to theQueryFunctionto call to retrieve the results.queryRequest- request used to retrieve the results.
-
resultIterable
public static ResultIterable resultIterable(ddf.catalog.CatalogFramework catalogFramework, ddf.catalog.operation.QueryRequest queryRequest, int maxResultCount) Creates an iterable that will call theCatalogFrameworkto retrieve the results that match theQueryRequestprovided.- Parameters:
catalogFramework- reference to theCatalogFrameworkto call to retrieve the results.queryRequest- request used to retrieve the results.maxResultCount- a positive integer indicating the maximum number of results in total to query for
-
resultIterable
public static ResultIterable resultIterable(QueryFunction queryFunction, ddf.catalog.operation.QueryRequest queryRequest, int maxResultCount) Creates an iterable that will call aQueryFunctionto retrieve the results that match theQueryRequestprovided. If the query request does not include a sort-by, then the code will default to sorting by the metacard ID in descending order.- Parameters:
queryFunction- reference to theQueryFunctionto call to retrieve the results.queryRequest- request used to retrieve the results.maxResultCount- a positive integer indicating the maximum number of results in total to query for
-
iterator
-
stream
-