it.unimi.dsi.mg4j.search.score
Class CountScorer
java.lang.Object
it.unimi.dsi.fastutil.ints.AbstractIntIterator
it.unimi.dsi.mg4j.search.score.AbstractScorer
it.unimi.dsi.mg4j.search.score.AbstractWeightedScorer
it.unimi.dsi.mg4j.search.score.CountScorer
- All Implemented Interfaces:
- IntIterator, FlyweightPrototype<Scorer>, DelegatingScorer, Scorer, Iterator<Integer>
public class CountScorer
- extends AbstractWeightedScorer
- implements DelegatingScorer
A trivial scorer that computes the score by adding the counts
(the number of occurrences within the current document) of each term
multiplied by the weight of the relative index.
Mainly useful for debugging and testing purposes.
This class uses a CounterCollectionVisitor
and related classes to take into consideration only terms that are actually involved
in the current document.
- Author:
- Mauro Mereu, Sebastiano Vigna
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator |
skip |
indexNumber2Weight
protected double[] indexNumber2Weight
- An array parallel to
TermCollectionVisitor.indices() containing the current corresponding values in AbstractWeightedScorer.index2Weight;
it is set up by wrap(DocumentIterator).
CountScorer
public CountScorer()
score
public double score()
throws IOException
- Description copied from class:
AbstractWeightedScorer
- Computes a score by calling
Scorer.score(Index) for
each index in the current document iterator, and adding the weighted results.
- Specified by:
score in interface Scorer- Overrides:
score in class AbstractWeightedScorer
- Returns:
- the combined weighted score.
- Throws:
IOException
score
public double score(Index index)
- Description copied from interface:
Scorer
- Returns a score for the current document of the last document iterator
given to
Scorer.wrap(DocumentIterator), but
considering only a given index (optional operation).
- Specified by:
score in interface Scorer
- Parameters:
index - the only index to be considered.
- Returns:
- the score.
wrap
public void wrap(DocumentIterator d)
throws IOException
- Description copied from class:
AbstractScorer
- Wraps the given document iterator.
This method records internally the provided iterator.
- Specified by:
wrap in interface Scorer- Overrides:
wrap in class AbstractWeightedScorer
- Parameters:
d - the document iterator that will be used in subsequent calls to
Scorer.score() and Scorer.score(Index).
- Throws:
IOException
copy
public CountScorer copy()
- Specified by:
copy in interface FlyweightPrototype<Scorer>- Specified by:
copy in interface DelegatingScorer- Specified by:
copy in interface Scorer
usesIntervals
public boolean usesIntervals()
- Description copied from interface:
Scorer
- Whether this scorer uses intervals.
This method is essential when aggregating scorers,
because if several scores need intervals, a CachingDocumentIterator
will be necessary.
- Specified by:
usesIntervals in interface Scorer
- Returns:
- true if this scorer uses intervals.