public class MatchingQueryTerms extends ArrayList<MatchingQueryTerms.MatchingTerm> implements Serializable, Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
MatchingQueryTerms.MatchingTerm |
static class |
MatchingQueryTerms.QueryTermProperties
The weight and the modifiers associated with a query term.
|
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
defaultTags |
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 |
modCount
Constructor and Description |
---|
MatchingQueryTerms()
Generate a MatchingQueryTerms object.
|
MatchingQueryTerms(Collection<MatchingQueryTerms.MatchingTerm> coll) |
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 |
---|---|
boolean |
add(MatchingQueryTerms.MatchingTerm e) |
void |
addDocumentScoreModifier(DocumentScoreModifier dsm)
Adds a document score modifier for the query.
|
void |
addTermPropertyWeight(String term,
double d) |
MatchingQueryTerms |
clone()
Performs a deep clone of this object, and all objects it contains.
|
protected MatchingQueryTerms.QueryTermProperties |
combine(MatchingQueryTerms.QueryTermProperties existingProps,
MatchingQueryTerms.QueryTermProperties newProps) |
MatchingQueryTerms.QueryTermProperties |
get(Operator term) |
Map.Entry<Operator,MatchingQueryTerms.QueryTermProperties> |
get(String singleTerm) |
DocumentScoreModifier[] |
getDocumentScoreModifiers()
Returns the document score modifiers used for the query.
|
Operator[] |
getMatchingTerms()
Returns the query terms, as they were added to this object.
|
List<MatchingQueryTerms.MatchingTerm> |
getMatchingTerms(String tag) |
Query |
getQuery()
Returns guess what?
|
String |
getQueryId()
Returns the query id specified when constructing this object.
|
Request |
getRequest()
Returns the request.
|
EntryStatistics |
getStatistics(Operator term)
Returns the assocciated code of the given query term.
|
EntryStatistics |
getStatistics(String term) |
String[] |
getTerms()
Returns the query terms, as they were added to this object.
|
double |
getTermWeight(Operator term)
Returns the associated weight of the given query term.
|
double |
getTermWeight(String term) |
double[] |
getTermWeights()
Returns the associated weights of the given query terms.
|
int |
length()
Deprecated.
|
void |
normaliseTermWeights()
This method normalises the term weights by dividing each term weight
by the maximum of the terms.
|
void |
removeTerm(Operator 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 terms that do NOT have an explicit WeightingModel set.
|
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(Operator term,
double weight)
Adds a term to the query with a given weight.
|
void |
setTermProperty(Operator term,
double weight,
WeightingModel tsm)
Sets the weight and a term score modifier for the given query term.
|
void |
setTermProperty(Operator term,
EntryStatistics e) |
void |
setTermProperty(Operator term,
WeightingModel tsm)
Sets a term score modifier for the given query term.
|
void |
setTermProperty(String term,
double weight) |
void |
setTermProperty(String term,
EntryStatistics e)
Sets a term's statistics for the given query term.
|
String |
toString() |
add, addAll, addAll, clear, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
protected String queryId
protected Request rq
protected WeightingModel defaultWeightingModel
protected ArrayList<DocumentScoreModifier> docScoreModifiers
protected Query query
public MatchingQueryTerms(Collection<MatchingQueryTerms.MatchingTerm> coll)
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 normaliseTermWeights()
public void resetTermProperties()
public void setTermProperty(Operator term, EntryStatistics e)
public void setTermProperty(String term, EntryStatistics e)
term
- String the term for which to override the statiticse
- EntryStatistics the term score modifier to apply for the given term.public void setTermProperty(Operator 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(Operator 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.protected MatchingQueryTerms.QueryTermProperties combine(MatchingQueryTerms.QueryTermProperties existingProps, MatchingQueryTerms.QueryTermProperties newProps)
public boolean add(MatchingQueryTerms.MatchingTerm e)
add
in interface Collection<MatchingQueryTerms.MatchingTerm>
add
in interface List<MatchingQueryTerms.MatchingTerm>
add
in class ArrayList<MatchingQueryTerms.MatchingTerm>
public double getTermWeight(Operator term)
term
- String the query term for which the weight is returned.public double getTermWeight(String term)
public double[] getTermWeights()
public EntryStatistics getStatistics(Operator term)
term
- String the query term for which the weight is returned.public EntryStatistics getStatistics(String term)
public MatchingQueryTerms.QueryTermProperties get(Operator term)
public Map.Entry<Operator,MatchingQueryTerms.QueryTermProperties> get(String singleTerm)
public void setTermProperty(String term, double weight)
public Operator[] getMatchingTerms()
public String[] getTerms()
public List<MatchingQueryTerms.MatchingTerm> getMatchingTerms(String tag)
public void setTermProperty(Operator term, double weight)
term
- String the term to add.weight
- double the weight of the added term.@Deprecated public int length()
public MatchingQueryTerms clone()
clone
in class ArrayList<MatchingQueryTerms.MatchingTerm>
public void removeTerm(Operator term)
public void setDefaultTermWeightingModel(WeightingModel weightingModel)
public void addTermPropertyWeight(String term, double d)
public String toString()
toString
in class AbstractCollection<MatchingQueryTerms.MatchingTerm>
Terrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow