public class SingleTermQuery extends Query
Query.ForEachQueryNode
Modifier and Type | Field and Description |
---|---|
protected static boolean |
lowercase
checks whether the terms should be lowercase.
|
int |
required
The optional required qualifier.
|
Constructor and Description |
---|
SingleTermQuery()
An empty default constructor.
|
SingleTermQuery(String t)
Creates an instance of the class for the
given query term.
|
SingleTermQuery(String t,
int r)
Creates an instance of the class for the
given query term that should be either required
or not.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applyTermPipeline(TermPipelineAccessor tpa)
Puts the query term in the given
term pipeline, which is accessed through the
given accessor object.
|
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.
|
String |
getTerm()
Gets the query term.
|
protected void |
getTerms(List<Query> alist)
Adds the query term in the given list of query terms.
|
void |
getTermsOf(Class<? extends Query> c,
List<Query> 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(Set<String> allowed,
Map<String,String> 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.
|
String |
parseTree()
Returns the parse tree for the query as a string
|
void |
setRequired(int r)
Sets the value of the required switch.
|
void |
setTerm(String t)
Sets the string of the term.
|
void |
setWeight(double w)
Sets the weight of the query term.
|
String |
toString()
Returns a string representation of the query term.
|
apply, obtainAllOf, setChild
protected static final boolean lowercase
public int required
public SingleTermQuery()
public SingleTermQuery(String t)
t
- String one query term.public SingleTermQuery(String t, int r)
t
- String one query term.r
- int indicates whether the term is required
or not.public void setRequired(int r)
r
- int the value of the required switch.public void setTerm(String t)
t
- String the query term.public String getTerm()
public int getRequired()
public String toString()
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.protected void getTerms(List<Query> alist)
public boolean obtainControls(Set<String> allowed, Map<String,String> controls)
obtainControls
in class Query
public void getTermsOf(Class<? extends Query> c, List<Query> 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 4.0. Copyright © 2004-2014 University of Glasgow