|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.gla.terrier.querying.parser.Query uk.ac.gla.terrier.querying.parser.SingleTermQuery
public class SingleTermQuery
Models a query of a single term.
The single term queries can be of the forms:
term
+term
-term
field:term
The term can be optionally followed by a weight, as shown below:
term^weight
+term^weight
-term^weight
field:term^weight
where weight is a real number. If no weight is specified, then the
default weight is 1.0.
Constructor Summary | |
---|---|
SingleTermQuery()
An empty default constructor. |
|
SingleTermQuery(java.lang.String t)
Creates an instance of the class for the given query term. |
|
SingleTermQuery(java.lang.String t,
int r)
Creates an instance of the class for the given query term that should be either required or not. |
Method Summary | |
---|---|
boolean |
applyTermPipeline(TermPipelineAccessor tpa)
Puts the query term in the given term pipeline, which is accessed through the given accessor object. |
java.lang.Object |
clone()
Deep copy this Query object |
int |
getRequired()
Indicates whether the query term is required, or it isn't required to appear in the retrieved documents. |
java.lang.String |
getTerm()
Gets the query term. |
void |
getTermsOf(java.lang.Class c,
java.util.ArrayList alist,
boolean req)
An empty method because the single term query cannot have children. |
double |
getWeight()
Returns the weight of the query term. |
boolean |
obtainControls(java.util.HashSet allowed,
java.util.Hashtable controls)
This object cannot contain any controls, so this method will always return false. |
void |
obtainQueryTerms(MatchingQueryTerms terms)
Stores the term of the single term query in the given hash map. |
void |
obtainQueryTerms(MatchingQueryTerms terms,
boolean required)
Stores the term of the single term query in the given hash map. |
void |
setRequired(int r)
Sets the value of the required switch. |
void |
setTerm(java.lang.String t)
Sets the string of the term. |
void |
setWeight(double w)
Sets the weight of the query term. |
java.lang.String |
toString()
Returns a string representation of the query term. |
Methods inherited from class uk.ac.gla.terrier.querying.parser.Query |
---|
obtainAllOf, setChild |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SingleTermQuery()
public SingleTermQuery(java.lang.String t)
t
- String one query term.public SingleTermQuery(java.lang.String t, int r)
t
- String one query term.r
- int indicates whether the term is required
or not.Method Detail |
---|
public java.lang.Object clone()
Query
clone
in class Query
public void setRequired(int r)
r
- int the value of the required switch.public void setTerm(java.lang.String t)
t
- String the query term.public java.lang.String getTerm()
public int getRequired()
public java.lang.String toString()
toString
in class Query
public void setWeight(double w)
w
- double the weight of the query term.public double getWeight()
public boolean applyTermPipeline(TermPipelineAccessor tpa)
applyTermPipeline
in class Query
tpa
- TermPipelineAccessor the object that provides
the term pipeline.
public void obtainQueryTerms(MatchingQueryTerms terms)
obtainQueryTerms
in class Query
terms
- the hashmap in which to store the query terms.public void obtainQueryTerms(MatchingQueryTerms terms, boolean required)
obtainQueryTerms
in class Query
terms
- the hashmap in which to store the query terms.required
- indicates whether the query term is required or not.public boolean obtainControls(java.util.HashSet allowed, java.util.Hashtable controls)
obtainControls
in class Query
public void getTermsOf(java.lang.Class c, java.util.ArrayList alist, boolean req)
getTermsOf
in class Query
c
- Class a class of queries.alist
- ArrayList the list of query terms.req
- boolean indicates whether the subqueries
are required or not.
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |