org.terrier.querying
Class QueryExpansion

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

public class QueryExpansion
extends java.lang.Object
implements PostProcess

Implements automatic query expansion as PostFilter that is applied to the resultset after 1st-time matching. Controls

Properties

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

Field Summary
protected  java.util.Map<java.lang.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<BitIndexPointer> directIndex
          The direct index used for retrieval.
protected  DocumentIndex documentIndex
          The document index used for retrieval.
protected  InvertedIndex invertedIndex
          The inverted index used for retrieval.
 java.lang.String lastExpandedQuery
           
protected  Index lastIndex
           
protected  Lexicon<java.lang.String> lexicon
          An instance of Lexicon class.
protected static org.apache.log4j.Logger logger
           
protected  MetaIndex metaIndex
           
static java.lang.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
 java.lang.String getInfo()
          Returns the name of the used query expansion model.
 QueryExpansionModel getQueryExpansionModel(java.lang.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 java.lang.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 java.util.Map<java.lang.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 InvertedIndex invertedIndex
The inverted index used for retrieval.


lexicon

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


directIndex

protected PostingIndex<BitIndexPointer> 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 java.lang.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 java.io.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:
java.io.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(java.lang.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 java.lang.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.5. Copyright © 2004-2011 University of Glasgow