Interface ResultsAggregator<T>

Type Parameters:
T - the type of the individual results

public interface ResultsAggregator<T>
An aggregator across results from multiple queries that may include duplicates. A provided key-making function provides a distinct sortable identifier for each result, allowing duplicates to be excluded and results to be provided in the correct order.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T result)
    Include the given result in the total, with earlier results taking precedence.
    void
    addAll(Iterable<? extends T> results)
    Include all the given results in the total, with earlier results taking precedence.
    Return the subset of results required by the initial query's paging parameters.
    constrainResults(Predicate<? super T> criteria)
    Return the subset of results required by the initial query's paging parameters which also satisfy the provided criteria.
    int
    Return the total number of results we need to fetch for this query.
    int
     
  • Method Details

    • add

      void add(T result)
      Include the given result in the total, with earlier results taking precedence. This means that any later result that uses the same key as an earlier one will be ignored.
      Parameters:
      result - a single result
    • addAll

      void addAll(Iterable<? extends T> results)
      Include all the given results in the total, with earlier results taking precedence. This means that any later result that uses the same key as an earlier one will be ignored.
      Parameters:
      results - an iterable collection of results
    • size

      int size()
      Returns:
      the current number of distinct results
    • constrainResults

      List<T> constrainResults()
      Return the subset of results required by the initial query's paging parameters.
      Returns:
      a subset of the results
    • constrainResults

      List<T> constrainResults(Predicate<? super T> criteria)
      Return the subset of results required by the initial query's paging parameters which also satisfy the provided criteria.
      Parameters:
      criteria - to be used when creating the subset of results to be returned.
      Returns:
      a subset of the results
    • getRequiredResultCount

      int getRequiredResultCount()
      Return the total number of results we need to fetch for this query. This will be start + maxResults from the original query, or EntityQuery.ALL_RESULTS if that was the original maximum. This number must be fetched from each underlying directory for correct aggregation.
      Returns:
      how many results need to be fetched overall