it.unimi.di.mg4j.search.score
Class ConstantScorer

java.lang.Object
  extended by it.unimi.di.mg4j.search.score.AbstractScorer
      extended by it.unimi.di.mg4j.search.score.ConstantScorer
All Implemented Interfaces:
DelegatingScorer, Scorer, FlyweightPrototype<Scorer>

public class ConstantScorer
extends AbstractScorer
implements DelegatingScorer

A scorer assigning a constant score (0 by default) to all documents.


Field Summary
 double score
           
 
Fields inherited from class it.unimi.di.mg4j.search.score.AbstractScorer
documentIterator, indexIterator
 
Constructor Summary
ConstantScorer()
           
ConstantScorer(double score)
           
ConstantScorer(String score)
           
 
Method Summary
 ConstantScorer copy()
           
 double score()
          Returns a score for the current document of the last document iterator given to Scorer.wrap(DocumentIterator).
 double score(Index index)
          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).
 String toString()
           
 boolean usesIntervals()
          Whether this scorer uses intervals.
 
Methods inherited from class it.unimi.di.mg4j.search.score.AbstractScorer
getWeights, nextDocument, setWeights, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.di.mg4j.search.score.Scorer
getWeights, nextDocument, setWeights, wrap
 

Field Detail

score

public final double score
Constructor Detail

ConstantScorer

public ConstantScorer(double score)

ConstantScorer

public ConstantScorer(String score)

ConstantScorer

public ConstantScorer()
Method Detail

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.

score

public double score()
Description copied from interface: Scorer
Returns a score for the current document of the last document iterator given to Scorer.wrap(DocumentIterator).

Specified by:
score in interface Scorer
Returns:
the score.

copy

public ConstantScorer copy()
Specified by:
copy in interface DelegatingScorer
Specified by:
copy in interface Scorer
Specified by:
copy in interface FlyweightPrototype<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.

toString

public String toString()
Overrides:
toString in class Object