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, setRequestprotected 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 WeightingModelpublic double score(Posting _p)
score in class WeightingModelpublic String getName()
public String getInfo()
WeightingModelgetInfo in interface ModelgetInfo in class WeightingModelpublic double score(double tf,
double docLength)
WeightingModelscore in class WeightingModeltf - The term frequency in the documentdocLength - the document's lengthpublic void setIndex(Index i)
setIndex in interface IndexConfigurablei - Index object to use@Deprecated public double score(double tf, double docLength, double n_t, double F_t, double _keyFrequency)
WeightingModelscore in class WeightingModeltf - 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