public class SingleTermQuery extends Query
Query.ForEachQueryNode, Query.QTPBuilder, Query.QueryTermsParameter
Modifier and Type | Field and Description |
---|---|
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,
String field,
Boolean required,
Double weight) |
void |
obtainQueryTerms(Query.QueryTermsParameter parameters) |
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
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, String field, Boolean required, Double weight)
obtainQueryTerms
in class Query
public void obtainQueryTerms(Query.QueryTermsParameter parameters)
obtainQueryTerms
in class Query
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 Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow