org.terrier.querying
Class Request

java.lang.Object
  extended by org.terrier.querying.Request
All Implemented Interfaces:
java.io.Serializable, SearchRequest

public class Request
extends java.lang.Object
implements SearchRequest

Request SearchRequest contains the details of the search engine for one query, including the query itself, the resultset, and the controls. Controls set application specific parameters, which often load post proceses, and postfilters, or set matching parameter. These are fundamentally, the names of the modules to be used for each stage of a query:

A Request is an implementation of the SearchRequest interface. Additionally, the Request holds all the controls set for this query.

Author:
Craig Macdonald, June & October 2004
See Also:
Serialized Form

Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> Control
          Controls are querying stage flags and variables.
protected  boolean EmptyQuery
          does the query have any terms.
protected  Index index
          index will not be passed across RMI
protected  MatchingQueryTerms matchingTerms
          This is an aggregated form of the query terms, suitable for matching, which requires term frequencies for each term.
protected  int numOfDocsAfterFiltering
          The number of documents returned after performing post filtering
protected  java.lang.String originalQuery
          The query text, before applying any pre-processsing
protected  Query q
          This contains the parsed syntax tree of the query, as generated by the Antlr parser
protected  java.lang.String QueryID
          QueryID - used by TREC querying and output format for supporting relevance assessments
protected  ResultSet resultSet
          This is the resultset of the query.
 
Constructor Summary
Request()
           
 
Method Summary
 void addMatchingModel(java.lang.String MatchingModelName, java.lang.String WeightingModelName)
          Set the matching model and weighting model that the Manager should use for this query
 java.lang.String getControl(java.lang.String Name)
          Returns the value of the control.
 java.util.Map<java.lang.String,java.lang.String> getControlHashtable()
          Get the entire hashtable used for storing controls for this query
 Index getIndex()
          Returns the index to be used for this query
 java.lang.String getMatchingModel()
          returns the name of the matching model that should be used for retrieval
 MatchingQueryTerms getMatchingQueryTerms()
          Return the MatchingQueryTerms object to use for matching
 int getNumberOfDocumentsAfterFiltering()
          returns the number of documents in the result set after applying post filters.
 java.lang.String getOriginalQuery()
          gets the string of the original query, before applying any pre-processing.
 Query getQuery()
          Get the Query syntax tree
 java.lang.String getQueryID()
          Returns the query id as set by setQueryID(String).
 ResultSet getResultSet()
          Returns the resultset generated by the query.
 long getStartedProcessingTime()
          returns the time when the processing of the request started.
 java.lang.String getWeightingModel()
          returns the name of the weighting model that should be used for retrieval
 boolean isEmpty()
          Set if the query input had no terms.
 void setControl(java.lang.String Name, java.lang.String Value)
          Set a control named to have value Value.
 void setControls(java.util.Map<java.lang.String,java.lang.String> controls)
          Use this hashtable to store controls and their values in
 void setEmpty(boolean in)
          force this query to be seen as containing (no) terms.
 void setIndex(Index _index)
          Set the index to be used for this query
 void setMatchingQueryTerms(MatchingQueryTerms mqts)
          Used by runPreProcessing after the query tree has been aggregated into a list of terms, each containing frequencies.
 void setNumberOfDocumentsAfterFiltering(int n)
          sets the number of documents in the result set, after applying post filters.
 void setOriginalQuery(java.lang.String _q)
          sets the string of the original query, before applying any pre-processing
 void setQuery(Query _q)
          Set the query to be a parsed Query syntax tree, as generated by the Terrier query parser
 void setQueryID(java.lang.String qid)
          Set a unique identifier for this query request.
 void setResultSet(ResultSet results)
          Set the result set returned by this object to be this results.
 void setStartedProcessingTime(long _startedProcessingTime)
          sets the time when the processing of the request started
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EmptyQuery

protected boolean EmptyQuery
does the query have any terms. Used by Manager.runMatching() to short circuit the matching process - if this is set, then a resultset with 0 documents is created automatically.


QueryID

protected java.lang.String QueryID
QueryID - used by TREC querying and output format for supporting relevance assessments


Control

protected java.util.Map<java.lang.String,java.lang.String> Control
Controls are querying stage flags and variables. These are typically set by defaults in the configuration file, or by flags in the query itself (if querying.HTTPSearchEngine is used). They often depict which pre, matching, post and output modules will be used.


q

protected Query q
This contains the parsed syntax tree of the query, as generated by the Antlr parser


originalQuery

protected java.lang.String originalQuery
The query text, before applying any pre-processsing


numOfDocsAfterFiltering

protected int numOfDocsAfterFiltering
The number of documents returned after performing post filtering


resultSet

protected ResultSet resultSet
This is the resultset of the query. It is provided by the matching/weighting stage, and may be operated on (eg decorated) by PostProcesses and PostFilters


matchingTerms

protected MatchingQueryTerms matchingTerms
This is an aggregated form of the query terms, suitable for matching, which requires term frequencies for each term.


index

protected transient Index index
index will not be passed across RMI

Constructor Detail

Request

public Request()
Method Detail

addMatchingModel

public void addMatchingModel(java.lang.String MatchingModelName,
                             java.lang.String WeightingModelName)
Set the matching model and weighting model that the Manager should use for this query

Specified by:
addMatchingModel in interface SearchRequest
Parameters:
MatchingModelName - the String class name that should be used
WeightingModelName - the String class name that should be used

setQuery

public void setQuery(Query _q)
Set the query to be a parsed Query syntax tree, as generated by the Terrier query parser

Specified by:
setQuery in interface SearchRequest
Parameters:
_q - The Query object syntax tree

setQueryID

public void setQueryID(java.lang.String qid)
Set a unique identifier for this query request.

Specified by:
setQueryID in interface SearchRequest
Parameters:
qid - the unique string identifier

setIndex

public void setIndex(Index _index)
Set the index to be used for this query


getIndex

public Index getIndex()
Returns the index to be used for this query


setControl

public void setControl(java.lang.String Name,
                       java.lang.String Value)
Set a control named to have value Value. This is essentially a hashtable wrappers. Controls are used to set properties of the retrieval process.

Specified by:
setControl in interface SearchRequest
Parameters:
Name - the name of the control to set the value of.
Value - the value that the control should take.

getControl

public java.lang.String getControl(java.lang.String Name)
Returns the value of the control. Null or empty string if not set.

Specified by:
getControl in interface SearchRequest
Returns:
the value.

getResultSet

public ResultSet getResultSet()
Returns the resultset generated by the query. Before retrieving this you probably need to have run Manager.runMatching, and (optionally, at your own risk) Manager.runPostProcesses() and Manager.runPostFiltering().

Specified by:
getResultSet in interface SearchRequest
Returns:
the resultset - ie the set of document Ids and their scores.

getQueryID

public java.lang.String getQueryID()
Returns the query id as set by setQueryID(String).

Specified by:
getQueryID in interface SearchRequest
Returns:
the query Id as a string.

getQuery

public Query getQuery()
Get the Query syntax tree

Specified by:
getQuery in interface SearchRequest
Returns:
The query object as set with setQuery.

isEmpty

public boolean isEmpty()
Set if the query input had no terms.

Specified by:
isEmpty in interface SearchRequest
Returns:
true if the query has no terms.

getWeightingModel

public java.lang.String getWeightingModel()
returns the name of the weighting model that should be used for retrieval


getMatchingModel

public java.lang.String getMatchingModel()
returns the name of the matching model that should be used for retrieval


setResultSet

public void setResultSet(ResultSet results)
Set the result set returned by this object to be this results.


getControlHashtable

public java.util.Map<java.lang.String,java.lang.String> getControlHashtable()
Get the entire hashtable used for storing controls for this query


setEmpty

public void setEmpty(boolean in)
force this query to be seen as containing (no) terms.

Parameters:
in - set to true for query to be seen empty.

setMatchingQueryTerms

public void setMatchingQueryTerms(MatchingQueryTerms mqts)
Used by runPreProcessing after the query tree has been aggregated into a list of terms, each containing frequencies.

Parameters:
mqts - The matchingqueryterms to use for matching.

getMatchingQueryTerms

public MatchingQueryTerms getMatchingQueryTerms()
Return the MatchingQueryTerms object to use for matching


setControls

public void setControls(java.util.Map<java.lang.String,java.lang.String> controls)
Use this hashtable to store controls and their values in


setOriginalQuery

public void setOriginalQuery(java.lang.String _q)
sets the string of the original query, before applying any pre-processing

Specified by:
setOriginalQuery in interface SearchRequest

getOriginalQuery

public java.lang.String getOriginalQuery()
gets the string of the original query, before applying any pre-processing.

Specified by:
getOriginalQuery in interface SearchRequest

setNumberOfDocumentsAfterFiltering

public void setNumberOfDocumentsAfterFiltering(int n)
sets the number of documents in the result set, after applying post filters.

Specified by:
setNumberOfDocumentsAfterFiltering in interface SearchRequest

getNumberOfDocumentsAfterFiltering

public int getNumberOfDocumentsAfterFiltering()
returns the number of documents in the result set after applying post filters.

Specified by:
getNumberOfDocumentsAfterFiltering in interface SearchRequest
Returns:
the number of documents returned for a search request. integer.

getStartedProcessingTime

public long getStartedProcessingTime()
returns the time when the processing of the request started.

Specified by:
getStartedProcessingTime in interface SearchRequest
Returns:
time long

setStartedProcessingTime

public void setStartedProcessingTime(long _startedProcessingTime)
sets the time when the processing of the request started

Specified by:
setStartedProcessingTime in interface SearchRequest
Parameters:
_startedProcessingTime - the time obtained from a call to System.currentTimeMillis()


Terrier 3.5. Copyright © 2004-2011 University of Glasgow