org.terrier.querying.parser
Class RequirementQuery

java.lang.Object
  extended by org.terrier.querying.parser.Query
      extended by org.terrier.querying.parser.RequirementQuery
All Implemented Interfaces:
Serializable, 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
 
Field Summary
 
Fields inherited from class org.terrier.querying.parser.Query
child, tmpSTQ
 
Constructor Summary
RequirementQuery()
          An empty default constructor.
 
Method Summary
 Object clone()
          Deep copy this Query object
 boolean getRequired()
          Returns True if the subquery is REQUIRED to exist, or false if it REQUIRED to NOT exit.
 void getTermsOf(Class<? extends Query> c, List<Query> alist, boolean req)
          Returns all the query terms, in subqueries that are instances of a given class.
 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 terms of the query in the given structure, which is used for matching documents to the query.
 String parseTree()
          Returns the parse tree for the query as a string
 void setRequired(boolean needed)
          Sets whether the query is required or not.
 String toString()
          Returns a string representation of the query.
 
Methods inherited from class org.terrier.querying.parser.Query
apply, applyTermPipeline, getTerms, obtainAllOf, obtainQueryTerms, setChild
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequirementQuery

public RequirementQuery()
An empty default constructor.

Method Detail

clone

public Object clone()
Deep copy this Query object

Overrides:
clone in class Query

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 String toString()
Returns a string representation of the query.

Specified by:
toString in class Query
Returns:
String a string representation of the query.

obtainQueryTerms

public void obtainQueryTerms(MatchingQueryTerms terms)
Stores the terms of the query in the given structure, which is used for matching documents to the query.

Overrides:
obtainQueryTerms in class Query
Parameters:
terms - MatchingQueryTerms the structure that holds the query terms for matching to documents.

obtainControls

public boolean obtainControls(Set<String> allowed,
                              Map<String,String> controls)
This object cannot contain any controls, so this method will always return false.

Overrides:
obtainControls in class Query
Returns:
false

getTermsOf

public void getTermsOf(Class<? extends Query> c,
                       List<Query> alist,
                       boolean req)
Returns all the query terms, in subqueries that are instances of a given class.

Specified by:
getTermsOf in class Query
Parameters:
c - Class a class of queries.
alist - ArrayList the list of query terms.
req - boolean indicates whether the subqueries are required or not.

parseTree

public String parseTree()
Description copied from class: Query
Returns the parse tree for the query as a string

Specified by:
parseTree in class Query


Terrier 3.6. Copyright © 2004-2011 University of Glasgow