Package org.terrier.matching.dsms
Class BooleanScoreModifier
- java.lang.Object
-
- 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
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
logger
protected static final org.slf4j.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 interfaceDocumentScoreModifier
- 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 interfaceDocumentScoreModifier
- 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 interfaceDocumentScoreModifier
- Overrides:
clone
in classjava.lang.Object
-
-