Package com.atlassian.crowd.search.util
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 TypeMethodDescriptionvoidInclude the given result in the total, with earlier results taking precedence.voidInclude 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.intReturn the total number of results we need to fetch for this query.intsize()
-
Method Details
-
add
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
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
Return the subset of results required by the initial query's paging parameters.- Returns:
- a subset of the results
-
constrainResults
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 bestart + maxResultsfrom the original query, orEntityQuery.ALL_RESULTSif 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
-