public class MatchingQueryTerms extends Object implements Serializable, Cloneable
Modifier and Type | Class and Description |
---|---|
protected static class |
MatchingQueryTerms.QueryTermProperties
The weight and the modifiers associated with a query term.
|
Modifier and Type | Field and Description |
---|---|
protected WeightingModel |
defaultWeightingModel
default weighting model for all terms
|
protected ArrayList<DocumentScoreModifier> |
docScoreModifiers
The document score modifiers associated with the query terms.
|
protected Query |
query
The original query as it came from the parser, in case any TSMs or DSMs
wish to refer to it
|
protected String |
queryId
The query ID, if provided
|
protected Request |
rq |
protected int |
termAdditionIndex |
protected HashMap<String,MatchingQueryTerms.QueryTermProperties> |
termProperties
A mapping from the string of a query term to its properties.
|
Constructor and Description |
---|
MatchingQueryTerms()
Generate a MatchingQueryTerms object.
|
MatchingQueryTerms(String qid)
Generate a MatchingQueryTerms object, with the specified query id.
|
MatchingQueryTerms(String qid,
Request _rq)
Generate a MatchingQueryTerms object, with the specified query id, and request
|
Modifier and Type | Method and Description |
---|---|
void |
addDocumentScoreModifier(DocumentScoreModifier dsm)
Adds a document score modifier for the query.
|
void |
addTermPropertyWeight(String term,
double w)
Adds the given weight for an already existing term in the query.
|
Object |
clone()
Performs a deep clone of this object, and all objects it contains.
|
DocumentScoreModifier[] |
getDocumentScoreModifiers()
Returns the document score modifiers used for the query.
|
Query |
getQuery()
Returns guess what?
|
String |
getQueryId()
Returns the query id specified when constructing this object.
|
Request |
getRequest()
Returns the request.
|
EntryStatistics |
getStatistics(String term)
Returns the assocciated code of the given query term.
|
String[] |
getTerms()
Returns the query terms, as they were added to this object.
|
double |
getTermWeight(String term)
Returns the assocciated weight of the given query term.
|
WeightingModel[] |
getTermWeightingModels(String term)
Returns the weighting models to be used for a given term.
|
double[] |
getTermWeights()
Returns the associated weights of the given query terms.
|
int |
length()
Returns the number of unique terms in the query.
|
void |
normaliseTermWeights()
This method normalises the term weights by dividing each term weight
by the maximum of the terms.
|
void |
removeTerm(String term)
Remove a term from the list of terms to be matched
|
void |
resetTermProperties()
This method resets query term statistics to allow for a single instance
of MatchingQueryTerms to be reused for matching against different indices.
|
void |
setDefaultTermWeightingModel(WeightingModel weightingModel)
Set the default weighting model to be used for all terms
|
void |
setQuery(Query q)
Allows the manager to set the query that was used to
query the system.
|
void |
setQueryId(String newId)
Sets the query id
|
void |
setTermProperty(String term)
Adds a term to the query.
|
void |
setTermProperty(String term,
double weight)
Adds a term to the query with a given weight.
|
void |
setTermProperty(String term,
double weight,
WeightingModel tsm)
Sets the weight and a term score modifier for the given query term.
|
void |
setTermProperty(String term,
EntryStatistics stats)
Sets the term statistics for the given query term.
|
void |
setTermProperty(String term,
WeightingModel tsm)
Sets a term score modifier for the given query term.
|
protected String queryId
protected Request rq
protected HashMap<String,MatchingQueryTerms.QueryTermProperties> termProperties
protected WeightingModel defaultWeightingModel
protected int termAdditionIndex
protected ArrayList<DocumentScoreModifier> docScoreModifiers
protected Query query
public MatchingQueryTerms()
public MatchingQueryTerms(String qid)
qid
- A string representation of the query idpublic Request getRequest()
public void addDocumentScoreModifier(DocumentScoreModifier dsm)
dsm
- DocumentScoreModifier a document score modifier for
the query.public DocumentScoreModifier[] getDocumentScoreModifiers()
public void setQuery(Query q)
q
- The Query, duhpublic Query getQuery()
public String getQueryId()
public void setQueryId(String newId)
public void setTermProperty(String term)
term
- String the term to add.public void setTermProperty(String term, double weight)
term
- String the term to add.weight
- double the weight of the added term.public void addTermPropertyWeight(String term, double w)
term
- String the term for which we add the weight.w
- double the added weight.public void setTermProperty(String term, EntryStatistics stats)
term
- String the term for which the term identifier is set.stats
- TermStatistics the statistics of the term.public void normaliseTermWeights()
public void resetTermProperties()
public void setTermProperty(String term, WeightingModel tsm)
term
- String the term for which to add a term score modifier.tsm
- TermScoreModifier the term score modifier to apply for the given term.public void setTermProperty(String term, double weight, WeightingModel tsm)
term
- String the term for which we set the properties.weight
- int the weight of the query term.tsm
- TermScoreModifier the term score modifier applied for the query term.public double getTermWeight(String term)
term
- String the query term for which the weight is returned.public double[] getTermWeights()
public EntryStatistics getStatistics(String term)
term
- String the query term for which the weight is returned.public String[] getTerms()
public int length()
public Object clone()
public void removeTerm(String term)
public WeightingModel[] getTermWeightingModels(String term)
public void setDefaultTermWeightingModel(WeightingModel weightingModel)
Terrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow