Terrier IR Platform
2.2.1

uk.ac.gla.terrier.querying.parser
Class PhraseQuery

java.lang.Object
  extended by uk.ac.gla.terrier.querying.parser.Query
      extended by uk.ac.gla.terrier.querying.parser.MultiTermQuery
          extended by uk.ac.gla.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.

Version:
$Revision: 1.18 $
Author:
Vassilis Plachouras, Craig Macdonald
See Also:
Serialized Form

Constructor Summary
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
 java.lang.Object clone()
          Deep copy this Query object
 void getTermsOf(java.lang.Class c, java.util.ArrayList alist, boolean req)
          Returns all the query terms, in subqueries that are instances of a given class
 boolean obtainControls(java.util.HashSet allowed, java.util.Hashtable controls)
          This object cannot contain any controls, so this method will always return false.
 void obtainQueryTerms(MatchingQueryTerms terms)
          Stores the query terms of the phrase query in the given matching query terms structure.
 void obtainQueryTerms(MatchingQueryTerms terms, boolean required)
          Stores the query terms of the phrase query in the given matching query terms structure.
 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 uk.ac.gla.terrier.querying.parser.MultiTermQuery
add, add, applyTermPipeline, getNumberOfTerms, obtainAllOf
 
Methods inherited from class uk.ac.gla.terrier.querying.parser.Query
setChild
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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()
Description copied from class: Query
Deep copy this Query object

Overrides:
clone in class MultiTermQuery

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 class MultiTermQuery
Returns:
String the string representation of the phrase query.

obtainQueryTerms

public void obtainQueryTerms(MatchingQueryTerms terms)
Stores the query terms of the phrase query in the given matching query terms structure. The query terms are required to appear in the matched documents.

Overrides:
obtainQueryTerms in class MultiTermQuery
Parameters:
terms - MatchingQueryTerms the structure that stores the query terms for matching.

obtainQueryTerms

public void obtainQueryTerms(MatchingQueryTerms terms,
                             boolean required)
Stores the query terms of the phrase query in the given matching query terms structure. Whether the phrase is required to appear in the retrieved documents, depends on the value of the parameter required.

Overrides:
obtainQueryTerms in class MultiTermQuery
Parameters:
terms - MatchingQueryTerms the structure that stores the query terms for matching.
required - boolean indicates whether the phrase is required or not.

obtainControls

public boolean obtainControls(java.util.HashSet allowed,
                              java.util.Hashtable controls)
This object cannot contain any controls, so this method will always return false.

Overrides:
obtainControls in class MultiTermQuery
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 c,
                       java.util.ArrayList alist,
                       boolean req)
Returns all the query terms, in subqueries that are instances of a given class

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

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow