org.terrier.querying
Class QueryExpansion

java.lang.Object
  extended by org.terrier.querying.QueryExpansion
All Implemented Interfaces:
PostProcess, Process

public class QueryExpansion
extends Object
implements PostProcess

Implements automatic query expansion as PostProcess that is applied to the result set after 1st-time matching. Controls

Properties

Author:
Gianni Amatti, Ben He, Vassilis Plachouras, Craig Macdonald

Field Summary
protected  Map<String,QueryExpansionModel> Cache_QueryExpansionModel
          Caching the query expansion models that have been created so far.
protected  CollectionStatistics collStats
          The statistics of the index
protected  PostingIndex<?> directIndex
          The direct index used for retrieval.
protected  DocumentIndex documentIndex
          The document index used for retrieval.
protected  PostingIndex<?> invertedIndex
          The inverted index used for retrieval.
 String lastExpandedQuery
           
protected  Index lastIndex
           
protected  Lexicon<String> lexicon
          An instance of Lexicon class.
protected static org.apache.log4j.Logger logger
           
protected  MetaIndex metaIndex
           
static String NAMESPACE_QEMODEL
          The default namespace of query expansion model classes.
protected  QueryExpansionModel QEModel
          The query expansion model used.
protected  FeedbackSelector selector
          The process by which to select feedback documents
 
Constructor Summary
QueryExpansion()
          The default constructor of QueryExpansion.
 
Method Summary
 void expandQuery(MatchingQueryTerms query, Request rq)
          This method implements the functionality of expanding a query.
protected  ExpansionTerms getExpansionTerms()
          load the expansion terms, as per the property qe.expansion.terms.class.
protected  FeedbackSelector getFeedbackSelector(Request rq)
          load the feedback selector, based on the property qe.feedback.selector
protected  Index getIndex(Manager m)
          For easier sub-classing of which index the query expansion comes from
 String getInfo()
          Returns the name of the used query expansion model.
 QueryExpansionModel getQueryExpansionModel(String Name)
          Obtain the query expansion model for QE to use.
 void process(Manager manager, SearchRequest q)
          Runs the actual query expansion
 void setQueryExpansionModel(QueryExpansionModel _QEModel)
          Set the used query expansion model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

NAMESPACE_QEMODEL

public static final String NAMESPACE_QEMODEL
The default namespace of query expansion model classes. The query expansion model names are prefixed with this namespace, if they are not fully qualified.

See Also:
Constant Field Values

Cache_QueryExpansionModel

protected Map<String,QueryExpansionModel> Cache_QueryExpansionModel
Caching the query expansion models that have been created so far.


documentIndex

protected DocumentIndex documentIndex
The document index used for retrieval.


metaIndex

protected MetaIndex metaIndex

invertedIndex

protected PostingIndex<?> invertedIndex
The inverted index used for retrieval.


lexicon

protected Lexicon<String> lexicon
An instance of Lexicon class.


directIndex

protected PostingIndex<?> directIndex
The direct index used for retrieval.


collStats

protected CollectionStatistics collStats
The statistics of the index


QEModel

protected QueryExpansionModel QEModel
The query expansion model used.


selector

protected FeedbackSelector selector
The process by which to select feedback documents


lastIndex

protected Index lastIndex

lastExpandedQuery

public String lastExpandedQuery
Constructor Detail

QueryExpansion

public QueryExpansion()
The default constructor of QueryExpansion.

Method Detail

setQueryExpansionModel

public void setQueryExpansionModel(QueryExpansionModel _QEModel)
Set the used query expansion model.

Parameters:
_QEModel - QueryExpansionModel The query expansion model to be used.

expandQuery

public void expandQuery(MatchingQueryTerms query,
                        Request rq)
                 throws IOException
This method implements the functionality of expanding a query.

Parameters:
query - MatchingQueryTerms the query terms of the original query.
rq - the Request thus far, giving access to the query and the result set
Throws:
IOException

getIndex

protected Index getIndex(Manager m)
For easier sub-classing of which index the query expansion comes from


getExpansionTerms

protected ExpansionTerms getExpansionTerms()
load the expansion terms, as per the property qe.expansion.terms.class. Defaults to DFRBagExpansionTerms.

Returns:
an ExpansionTerms instance, which may or may not wrap other ExpansionTerms instances

getFeedbackSelector

protected FeedbackSelector getFeedbackSelector(Request rq)
load the feedback selector, based on the property qe.feedback.selector


process

public void process(Manager manager,
                    SearchRequest q)
Runs the actual query expansion

Specified by:
process in interface Process
Parameters:
manager - The manager instance handling this search session.
q - the current query being processed
See Also:
Process.process(org.terrier.querying.Manager,org.terrier.querying.SearchRequest)

getQueryExpansionModel

public QueryExpansionModel getQueryExpansionModel(String Name)
Obtain the query expansion model for QE to use. This will be cached in a hashtable for the lifetime of the application. If Name does not contain ".", then NAMESPACE_QEMODEL will be prefixed to it before loading.

Parameters:
Name - the name of the query expansion model to load.

getInfo

public String getInfo()
Returns the name of the used query expansion model.

Specified by:
getInfo in interface Process
Returns:
String the name of the used query expansion model.


Terrier 3.6. Copyright © 2004-2011 University of Glasgow