public class TermInFieldModifier extends WeightingModel implements IndexConfigurable
Modifier and Type | Field and Description |
---|---|
protected String |
field
The fields that a query term should appear in.
|
protected Index |
index |
protected boolean |
requirement
The requirement.
|
averageDocumentLength, c, cs, documentFrequency, es, i, keyFrequency, numberOfDocuments, numberOfPointers, numberOfTokens, numberOfUniqueTerms, rq, termFrequency
Constructor and Description |
---|
TermInFieldModifier(String _field)
Constructs an instance of a TermInFieldModifier given a
field that the corresponding query term should appear in.
|
TermInFieldModifier(String _field,
boolean req)
Constructs an instance of a TermInFieldModifier given a
field that the corresponding query term should appear in.
|
Modifier and Type | Method and Description |
---|---|
String |
getInfo()
Returns the name of the model.
|
String |
getName()
Returns the name of the class and whether the query term is required.
|
int |
modifyScores(double[] scores,
int[][] pointers)
Resets the scores of documents for a particular term, based on
the fields a term appears in documents.
|
void |
prepare()
prepare
|
double |
score(double tf,
double docLength)
This method provides the contract for implementing weighting models.
|
double |
score(double tf,
double docLength,
double n_t,
double F_t,
double _keyFrequency)
Deprecated.
|
double |
score(Posting _p)
Returns score
|
void |
setIndex(Index i)
Tell the implementer which Index object it is associated with.
|
clone, getOverflowed, getParameter, setCollectionStatistics, setEntryStatistics, setKeyFrequency, setParameter, setRequest
protected transient Index index
protected String field
protected boolean requirement
public TermInFieldModifier(String _field)
_field
- String a fieldpublic TermInFieldModifier(String _field, boolean req)
_field
- String a fieldreq
- boolean the requirement for this field. If req is
true, then the term is required to appear in the field
(this is the default behaviour), otherwise the term
should not appear in the field.public int modifyScores(double[] scores, int[][] pointers)
scores
- double[] the scores of the documents.pointers
- int[][] the pointers read from the inverted file
for a particular query term.public void prepare()
prepare
in class WeightingModel
public double score(Posting _p)
score
in class WeightingModel
public String getName()
public String getInfo()
WeightingModel
getInfo
in interface Model
getInfo
in class WeightingModel
public double score(double tf, double docLength)
WeightingModel
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's lengthpublic void setIndex(Index i)
setIndex
in interface IndexConfigurable
i
- Index object to use@Deprecated public double score(double tf, double docLength, double n_t, double F_t, double _keyFrequency)
WeightingModel
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's lengthn_t
- The document frequency of the termF_t
- the term frequency in the collection_keyFrequency
- the term frequency in the queryTerrier 4.0. Copyright © 2004-2014 University of Glasgow