Class CountScorer
- java.lang.Object
-
- it.unimi.di.big.mg4j.search.score.AbstractScorer
-
- it.unimi.di.big.mg4j.search.score.AbstractWeightedScorer
-
- it.unimi.di.big.mg4j.search.score.CountScorer
-
- All Implemented Interfaces:
DelegatingScorer,Scorer,FlyweightPrototype<Scorer>
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
CounterCollectionVisitorand related classes to take into consideration only terms that are actually involved in the current document.- Author:
- Mauro Mereu, Sebastiano Vigna
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]indexNumber2WeightAn array parallel toTermCollectionVisitor.indices()containing the current corresponding values inAbstractWeightedScorer.index2Weight; it is set up bywrap(DocumentIterator).-
Fields inherited from class it.unimi.di.big.mg4j.search.score.AbstractWeightedScorer
index2Weight
-
Fields inherited from class it.unimi.di.big.mg4j.search.score.AbstractScorer
documentIterator, indexIterator
-
-
Constructor Summary
Constructors Constructor Description CountScorer()
-
Method Summary
Modifier and Type Method Description CountScorercopy()doublescore()Computes a score by callingScorer.score(Index)for each index in the current document iterator, and adding the weighted results.doublescore(Index index)Returns a score for the current document of the last document iterator given toScorer.wrap(DocumentIterator), but considering only a given index (optional operation).booleanusesIntervals()Whether this scorer uses intervals.voidwrap(DocumentIterator d)Wraps the given document iterator.-
Methods inherited from class it.unimi.di.big.mg4j.search.score.AbstractWeightedScorer
getWeights, setWeights
-
Methods inherited from class it.unimi.di.big.mg4j.search.score.AbstractScorer
nextDocument
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.di.big.mg4j.search.score.Scorer
getWeights, nextDocument, setWeights
-
-
-
-
Field Detail
-
indexNumber2Weight
protected double[] indexNumber2Weight
An array parallel toTermCollectionVisitor.indices()containing the current corresponding values inAbstractWeightedScorer.index2Weight; it is set up bywrap(DocumentIterator).
-
-
Method Detail
-
score
public double score() throws IOExceptionDescription copied from class:AbstractWeightedScorerComputes a score by callingScorer.score(Index)for each index in the current document iterator, and adding the weighted results.- Specified by:
scorein interfaceScorer- Overrides:
scorein classAbstractWeightedScorer- Returns:
- the combined weighted score.
- Throws:
IOException
-
score
public double score(Index index)
Description copied from interface:ScorerReturns a score for the current document of the last document iterator given toScorer.wrap(DocumentIterator), but considering only a given index (optional operation).
-
wrap
public void wrap(DocumentIterator d) throws IOException
Description copied from class:AbstractScorerWraps the given document iterator.This method records internally the provided iterator.
- Specified by:
wrapin interfaceScorer- Overrides:
wrapin classAbstractWeightedScorer- Parameters:
d- the document iterator that will be used in subsequent calls toScorer.score()andScorer.score(Index).- Throws:
IOException
-
copy
public CountScorer copy()
- Specified by:
copyin interfaceFlyweightPrototype<Scorer>- Specified by:
copyin interfaceScorer
-
usesIntervals
public boolean usesIntervals()
Description copied from interface:ScorerWhether this scorer uses intervals.This method is essential when aggregating scorers, because if several scores need intervals, a
CachingDocumentIteratorwill be necessary.- Specified by:
usesIntervalsin interfaceScorer- Returns:
- true if this scorer uses intervals.
-
-