org.terrier.matching.dsms
Class BooleanScoreModifier

java.lang.Object
  extended by org.terrier.matching.dsms.BooleanScoreModifier
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DocumentScoreModifier

public class BooleanScoreModifier
extends java.lang.Object
implements DocumentScoreModifier, java.io.Serializable

If not all the query terms appear in a document, then this modifier zeros the document's score.

Author:
Vassilis Plachouras and Craig Macdonald
See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
          the logger for this class
protected  java.util.ArrayList<Query> terms
          The terms to check.
 
Constructor Summary
BooleanScoreModifier()
          An empty default constructor.
BooleanScoreModifier(java.util.ArrayList<Query> ts)
          A constructor where we specify which of the query terms should exist in the documents.
 
Method Summary
 java.lang.Object clone()
          Clone this DSM.
 java.lang.String getName()
          Returns the name of the document score modifier.
 boolean modifyScores(Index index, MatchingQueryTerms query, ResultSet resultSet)
          Zeros the scores of documents in which only some of the query terms appear.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
the logger for this class


terms

protected java.util.ArrayList<Query> terms
The terms to check. If this is null, then we check for the whole query. This property can only be set from the constructor.

Constructor Detail

BooleanScoreModifier

public BooleanScoreModifier()
An empty default constructor.


BooleanScoreModifier

public BooleanScoreModifier(java.util.ArrayList<Query> ts)
A constructor where we specify which of the query terms should exist in the documents.

Parameters:
ts - ArrayList the query terms that should appear in the retrieved documents after applying this modifier.
Method Detail

getName

public java.lang.String getName()
Returns the name of the document score modifier.

Specified by:
getName in interface DocumentScoreModifier
Returns:
String the name of the modifier.

modifyScores

public boolean modifyScores(Index index,
                            MatchingQueryTerms query,
                            ResultSet resultSet)
Zeros the scores of documents in which only some of the query terms appear.

Specified by:
modifyScores in interface DocumentScoreModifier
Parameters:
index - Index the data structures used for retrieval.
query - TermTreeNode[] the array of the query terms.
resultSet - ResultSet the set of retrieved documents.
Returns:
true if any scores have been altered

clone

public java.lang.Object clone()
Clone this DSM. Note that terms is shall copied.

Specified by:
clone in interface DocumentScoreModifier
Overrides:
clone in class java.lang.Object


Terrier 3.5. Copyright © 2004-2011 University of Glasgow