Terrier IR Platform
2.2.1

uk.ac.gla.terrier.querying
Class Request

java.lang.Object
  extended by uk.ac.gla.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.

Version:
$Revision: 1.16 $
Author:
Craig Macdonald, June & October 2004
See Also:
Serialized Form

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.Hashtable getControlHashtable()
          Get the entire hashtable used for storing controls 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.Hashtable<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 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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.Hashtable 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.Hashtable<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

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 IR Platform
2.2.1

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