|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.matching.MatchingQueryTerms
public class MatchingQueryTerms
Models a query used for matching documents. It is created by creating an instance of this class, and then passing it as an argument to the method obtainQueryTerms of a Query. It contains the query terms, their weights, optionally the corresponding term identifiers and the assocciated term score modifiers. It also stores the document score modifiers for the query.
Nested Class Summary | |
---|---|
protected static class |
MatchingQueryTerms.QueryTermProperties
The weight and the modifiers associated with a query term. |
Field Summary | |
---|---|
protected WeightingModel |
defaultWeightingModel
default weighting model for all terms |
protected java.util.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 java.lang.String |
queryId
The query ID, if provided |
protected Request |
rq
|
protected int |
termAdditionIndex
|
protected java.util.HashMap<java.lang.String,MatchingQueryTerms.QueryTermProperties> |
termProperties
A mapping from the string of a query term to its properties. |
Constructor Summary | |
---|---|
MatchingQueryTerms()
Generate a MatchingQueryTerms object. |
|
MatchingQueryTerms(java.lang.String qid)
Generate a MatchingQueryTerms object, with the specified query id. |
|
MatchingQueryTerms(java.lang.String qid,
Request _rq)
Generate a MatchingQueryTerms object, with the specified query id, and request |
Method Summary | |
---|---|
void |
addDocumentScoreModifier(DocumentScoreModifier dsm)
Adds a document score modifier for the query. |
void |
addTermPropertyWeight(java.lang.String term,
double w)
Adds the given weight for an already existing term in the query. |
java.lang.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? |
java.lang.String |
getQueryId()
Returns the query id specified when constructing this object. |
Request |
getRequest()
Returns the request. |
EntryStatistics |
getStatistics(java.lang.String term)
Returns the assocciated code of the given query term. |
java.lang.String[] |
getTerms()
Returns the query terms, as they were added to this object. |
double |
getTermWeight(java.lang.String term)
Returns the assocciated weight of the given query term. |
WeightingModel[] |
getTermWeightingModels(java.lang.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 |
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(java.lang.String newId)
Sets the query id |
void |
setTermProperty(java.lang.String term)
Adds a term to the query. |
void |
setTermProperty(java.lang.String term,
double weight)
Adds a term to the query with a given weight. |
void |
setTermProperty(java.lang.String term,
double weight,
WeightingModel tsm)
Sets the weight and a term score modifier for the given query term. |
void |
setTermProperty(java.lang.String term,
EntryStatistics stats)
Sets the term statistics for the given query term. |
void |
setTermProperty(java.lang.String term,
WeightingModel tsm)
Sets a term score modifier for the given query term. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String queryId
protected Request rq
protected java.util.HashMap<java.lang.String,MatchingQueryTerms.QueryTermProperties> termProperties
protected WeightingModel defaultWeightingModel
protected int termAdditionIndex
protected java.util.ArrayList<DocumentScoreModifier> docScoreModifiers
protected Query query
Constructor Detail |
---|
public MatchingQueryTerms()
public MatchingQueryTerms(java.lang.String qid)
qid
- A string representation of the query idpublic MatchingQueryTerms(java.lang.String qid, Request _rq)
qid
- A string representation of the query id_rq
- A request for matchingMethod Detail |
---|
public 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 java.lang.String getQueryId()
public void setQueryId(java.lang.String newId)
public void setTermProperty(java.lang.String term)
term
- String the term to add.public void setTermProperty(java.lang.String term, double weight)
term
- String the term to add.weight
- double the weight of the added term.public void addTermPropertyWeight(java.lang.String term, double w)
term
- String the term for which we add the weight.w
- double the added weight.public void setTermProperty(java.lang.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(java.lang.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(java.lang.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(java.lang.String term)
term
- String the query term for which the weight is returned.
public double[] getTermWeights()
public EntryStatistics getStatistics(java.lang.String term)
term
- String the query term for which the weight is returned.
public java.lang.String[] getTerms()
public int length()
public java.lang.Object clone()
clone
in class java.lang.Object
public WeightingModel[] getTermWeightingModels(java.lang.String term)
public void setDefaultTermWeightingModel(WeightingModel weightingModel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |