Package org.terrier.querying.parser
Class PhraseQuery
- java.lang.Object
-
- org.terrier.querying.parser.Query
-
- org.terrier.querying.parser.MultiTermQuery
-
- org.terrier.querying.parser.PhraseQuery
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class PhraseQuery extends MultiTermQuery
Models a phrase query, which can have a proximity requirement.- 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
-
-
Field Summary
Fields Modifier and Type Field Description protected int
proximityDistance
Indicates the distance, in number of blocks, that the phrase terms can appear in a document.-
Fields inherited from class org.terrier.querying.parser.MultiTermQuery
prefix, suffix, v
-
-
Constructor Summary
Constructors Constructor Description PhraseQuery()
A default constructor that calls the constructor of the super class.PhraseQuery(int proxDistance)
Constructs a phrase query and sets the proximity distance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Deep copy this Query objectvoid
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 classboolean
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.void
obtainQueryTerms(MatchingQueryTerms terms, java.lang.String field, java.lang.Boolean required, java.lang.Double weight)
void
obtainQueryTerms(Query.QueryTermsParameter parameters)
void
setProximityDistance(int prox)
Sets the allowed distance, in blocks, between the phrase terms.java.lang.String
toString()
Returns a string representation of the phrase query.-
Methods inherited from class org.terrier.querying.parser.MultiTermQuery
add, add, apply, applyTermPipeline, getNumberOfTerms, getTerms, obtainAllOf, parseTree, replace, setWeight
-
-
-
-
Constructor Detail
-
PhraseQuery
public PhraseQuery()
A default constructor that calls the constructor of the super class.
-
PhraseQuery
public PhraseQuery(int proxDistance)
Constructs a phrase query and sets the proximity distance- Parameters:
proxDistance
- int the distance, in number of blocks, that the phrase terms can appear in a document.
-
-
Method Detail
-
clone
public java.lang.Object clone()
Deep copy this Query object- Overrides:
clone
in classMultiTermQuery
-
setProximityDistance
public void setProximityDistance(int prox)
Sets the allowed distance, in blocks, between the phrase terms.- Parameters:
prox
- the allowed distance between the phrase terms.
-
toString
public java.lang.String toString()
Returns a string representation of the phrase query.- Overrides:
toString
in classMultiTermQuery
- Returns:
- String the string representation of the phrase query.
-
obtainQueryTerms
public void obtainQueryTerms(MatchingQueryTerms terms, java.lang.String field, java.lang.Boolean required, java.lang.Double weight)
- Overrides:
obtainQueryTerms
in classMultiTermQuery
-
obtainQueryTerms
public void obtainQueryTerms(Query.QueryTermsParameter parameters)
- Overrides:
obtainQueryTerms
in classMultiTermQuery
-
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:
obtainControls
in classMultiTermQuery
- Parameters:
allowed
- The HashSet of control names that are allowed to be set.controls
- The Hashtable into which child objects much add found controls- 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- Overrides:
getTermsOf
in classMultiTermQuery
- Parameters:
c
- Class a class of queries.alist
- ArrayList the list of query terms.req
- boolean indicates whether the subqueries are required or not.
-
-