Package org.terrier.querying.parser
Class RequirementQuery
- java.lang.Object
-
- org.terrier.querying.parser.Query
-
- org.terrier.querying.parser.RequirementQuery
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class RequirementQuery extends Query
Models a query where the query terms have been qualified with a requirement operator, either plus, or minus.- Author:
- Vassilis Plachouras & Craig Macdonald
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.terrier.querying.parser.Query
Query.ForEachQueryNode, Query.QTPBuilder, Query.QueryTermsParameter
-
-
Constructor Summary
Constructors Constructor Description RequirementQuery()An empty default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Deep copy this Query objectbooleangetRequired()Returns True if the subquery is REQUIRED to exist, or false if it REQUIRED to NOT exit.voidgetTermsOf(java.lang.Class<? extends Query> c, java.util.List<Query> alist, boolean req)Returns all the query terms, in subqueries that are instances of a given class.booleanobtainControls(java.util.Set<java.lang.String> allowed, java.util.Map<java.lang.String,java.lang.String> controls)This object cannot contain any controls, so this method will always return false.voidobtainQueryTerms(MatchingQueryTerms terms, java.lang.String field, java.lang.Boolean required, java.lang.Double weight)voidobtainQueryTerms(Query.QueryTermsParameter parameters)java.lang.StringparseTree()Returns the parse tree for the query as a stringvoidsetRequired(boolean needed)Sets whether the query is required or not.java.lang.StringtoString()Returns a string representation of the query.-
Methods inherited from class org.terrier.querying.parser.Query
apply, applyTermPipeline, getTerms, obtainAllOf, setChild
-
-
-
-
Method Detail
-
setRequired
public void setRequired(boolean needed)
Sets whether the query is required or not.- Parameters:
needed- boolean indicates whether the query is required or not.
-
getRequired
public boolean getRequired()
Returns True if the subquery is REQUIRED to exist, or false if it REQUIRED to NOT exit.- Returns:
- See above.
-
toString
public java.lang.String toString()
Returns a string representation of the query.
-
obtainQueryTerms
public void obtainQueryTerms(MatchingQueryTerms terms, java.lang.String field, java.lang.Boolean required, java.lang.Double weight)
- Specified by:
obtainQueryTermsin classQuery
-
obtainQueryTerms
public void obtainQueryTerms(Query.QueryTermsParameter parameters)
- Specified by:
obtainQueryTermsin classQuery
-
obtainControls
public boolean obtainControls(java.util.Set<java.lang.String> allowed, java.util.Map<java.lang.String,java.lang.String> controls)This object cannot contain any controls, so this method will always return false.- Overrides:
obtainControlsin classQuery- Returns:
- false
-
getTermsOf
public void getTermsOf(java.lang.Class<? extends Query> c, java.util.List<Query> alist, boolean req)
Returns all the query terms, in subqueries that are instances of a given class.- Specified by:
getTermsOfin classQuery- Parameters:
c- Class a class of queries.alist- ArrayList the list of query terms.req- boolean indicates whether the subqueries are required or not.
-
-