it.unimi.dsi.mg4j.search.score
Class LinearAggregator

java.lang.Object
  extended byit.unimi.dsi.mg4j.search.score.LinearAggregator

public class LinearAggregator
extends Object

Merges a number of ScoredDocumentIterators, obtaining a new ScoredDocumentIterator. This is done in the following way: you provide an LinearAggregator with a number of ScoredDocumentIterators, each with an associated weight and a boolean (called relevance flag).

A document is said to be relevant iff it is returned by at least one of the ScoredDocumentIterators that have the relevance flag set. For every relevant document, its aggregate score is obtained by combining linearly (using the given weights) the scores returned by the ScoredDocumentIterators for that index. The scores returned by each ScoredDocumentIterator are firstly normalized (i.e., they are divided by the greatest score they ever return, unless they are constantly zero).

Note that the aggregate iterator returned by the aggregation method will only return documents and their scores (no interval iterators!).


Constructor Summary
LinearAggregator(boolean[] relevant, double[] weight)
          Creates a linear aggregator.
 
Method Summary
 ScoredDocumentIterator aggregate(ScoredDocumentIterator[] underlying)
          Aggregates the given ScoredDocumentIterators, that must be in the same number as there are weights (and relevance flags).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearAggregator

public LinearAggregator(boolean[] relevant,
                        double[] weight)
Creates a linear aggregator.

Parameters:
relevant - the array of relevance flags.
weight - the array of weights.
Method Detail

aggregate

public ScoredDocumentIterator aggregate(ScoredDocumentIterator[] underlying)
Aggregates the given ScoredDocumentIterators, that must be in the same number as there are weights (and relevance flags).

Parameters:
underlying - the underlying iterators to be merged.
Returns:
the aggregate iterator.