public abstract class ResultAccumulator extends Object
Accumulator for sorted lists of results. This class will return result lists, with the highest-scored result first.
Create one with create(int).
| Modifier and Type | Method and Description |
|---|---|
void |
add(long item,
double score)
Add a basic result to the accumulator.
|
abstract void |
add(Result r)
Add a result to the accumulator.
|
static ResultAccumulator |
create(int n)
Create a new result accumulator.
|
abstract ResultList |
finish()
Finish accumulating and return the accumulated results.
|
public static ResultAccumulator create(int n)
Create a new result accumulator.
n - The number of results desired; -1 for unlimited.public abstract void add(@Nonnull Result r)
Add a result to the accumulator.
r - The result to add.public void add(long item,
double score)
Add a basic result to the accumulator.
item - The item ID to add.score - The score to add.public abstract ResultList finish()
Finish accumulating and return the accumulated results.
When this method is called, the accumulator is reset and can be used to accumulate a fresh set of results.