Class ResultIterable

java.lang.Object
ddf.catalog.util.impl.ResultIterable
All Implemented Interfaces:
Iterable<ddf.catalog.data.Result>

public class ResultIterable extends Object implements 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 Details

  • Method Details

    • resultIterable

      public static ResultIterable resultIterable(ddf.catalog.CatalogFramework catalogFramework, ddf.catalog.operation.QueryRequest queryRequest)
      Creates an iterable that will call the CatalogFramework to retrieve the results that match the QueryRequest provided. There will be no limit to the number of results returned.
      Parameters:
      catalogFramework - reference to the CatalogFramework to 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 a QueryFunction to retrieve the results that match the QueryRequest provided. There will be no limit to the number of results returned.
      Parameters:
      queryFunction - reference to the QueryFunction to 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 the CatalogFramework to retrieve the results that match the QueryRequest provided.
      Parameters:
      catalogFramework - reference to the CatalogFramework to 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 a QueryFunction to retrieve the results that match the QueryRequest provided. 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 the QueryFunction to 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

      public Iterator<ddf.catalog.data.Result> iterator()
      Specified by:
      iterator in interface Iterable<ddf.catalog.data.Result>
    • stream

      public Stream<ddf.catalog.data.Result> stream()