org.terrier.querying
Class Manager

java.lang.Object
  extended by org.terrier.querying.Manager

public class Manager
extends java.lang.Object

This class is responsible for handling/co-ordinating the main high-level operations of a query. These are:

  • Pre Processing (Term Pipeline, Control finding, term aggregration)
  • Matching
  • Post-processing @see org.terrier.querying.PostProcess
  • Post-filtering @see org.terrier.querying.PostFilter
  • </ul> Example usage:
     Manager m = new Manager(index);
     SearchRequest srq = m.newSearchRequest("Q1", "term1 title:term2");
     m.runPreProcessing(srq);
     m.runMatching(srq);
     m.runPostProcess(srq);
     m.runPostFilters(srq);
     

    Properties

    Controls


    Field Summary
    protected  java.util.Set<java.lang.String> Allowed_Controls
              This contains a list of controls that may be set in the querying API
    protected  java.util.Map<Index,java.util.Map<java.lang.String,Matching>> Cache_Matching
              Cache loaded Matching models per Index in this map
    protected  java.util.Map<java.lang.String,PostFilter> Cache_PostFilter
              Cache loaded PostFitler models in this map
    protected  java.util.Map<java.lang.String,PostProcess> Cache_PostProcess
              Cache loaded PostProcess models in this map
    protected  java.util.Map<java.lang.String,Process> Cache_PreProcess
              Cache loaded PostProcess models in this map
    protected  boolean CACHING_FILTERS
               
    protected  java.util.Map<java.lang.String,java.lang.String> Default_Controls
              This contains the mapping of controls and their values that should be set identially for each query created by this Manager
    protected  int Defaults_Size
              How many default controls exist.
    protected  Index index
              The index this querying comes from
    protected static org.apache.log4j.Logger logger
               
    protected  boolean MATCH_EMPTY_QUERY
               
    static java.lang.String NAMESPACE_MATCHING
              The default namespace for Matching models to be loaded from
    static java.lang.String NAMESPACE_POSTFILTER
              The default namespace for PostFilters to be loaded from
    static java.lang.String NAMESPACE_POSTPROCESS
              The default namespace for PostProcesses to be loaded from
    static java.lang.String NAMESPACE_PREPROCESS
              The default namespace for PreProcesses to be loaded from
    static java.lang.String NAMESPACE_WEIGHTING
              The default namespace for Weighting models to be loaded from
    protected  java.lang.String pipelineOutput
              This class is used as a TermPipelineAccessor, and this variable stores the result of the TermPipeline run for that term.
    protected  java.lang.String[][] PostFilters_Controls
              A 2d array, contains (on 2nd level) the list of controls that turn on the PostFilters at the same 1st level place on PostFilters_Order
    protected  java.lang.String[] PostFilters_Order
              An ordered list of post filters names.
    protected  java.lang.String[][] PostProcesses_Controls
              A 2d array, contains (on 2nd level) the list of controls that turn on the PostProcesses at the same 1st level place on PostProcesses_Order
    protected  java.lang.String[] PostProcesses_Order
              An ordered list of post process names.
    protected  java.lang.String[][] PreProcesses_Controls
              A 2d array, contains (on 2nd level) the list of controls that turn on the PostProcesses at the same 1st level place on PostProcesses_Order
    protected  java.lang.String[] PreProcesses_Order
              An ordered list of post process names.
    protected static java.lang.String[][] tinyDoubleStringArray
               
    protected static java.lang.String[] tinySingleStringArray
               
    protected  TermPipelineAccessor tpa
              TermPipeline processing
     
    Constructor Summary
    Manager()
              Default constructor.
    Manager(Index _index)
              Construct a Manager using the specified Index Throws IllegalArgumentException if the specified index is null
     
    Method Summary
     Index getIndex()
              Returns the index used by the manager.
     java.lang.String getInfo(SearchRequest srq)
              Returns information about the weighting models and the post processors used for the given search request.
    protected  Matching getMatchingModel(Request rq)
              Returns the matching model indicated to be used, based on the Index and the Matching name specified in the passed Request object.
    protected  PostFilter getPostFilterModule(java.lang.String Name)
              Returns the post filter class named ModelName.
    protected  PostProcess getPostProcessModule(java.lang.String Name)
              Returns the PostProcess named Name.
    protected  Process getPreProcessModule(java.lang.String Name)
              Returns the PostProcess named Name.
    protected  Model getWeightingModel(Request rq)
              Returns the weighting model requested by the Reqes from the WeightingModel factory.
    protected  void load_controls_allowed()
              load in the controls that user is allowed to set
    protected  void load_controls_default()
              load in the control defaults
    protected  void load_pipeline()
              load in the term pipeline
    protected  void load_postfilters_controls()
              load in the allowed post filter controls, and the order to run post processes in
    protected  void load_postprocess_controls()
              load in the allowed postprocceses controls, and the order to run post processes in
    protected  void load_preprocess_controls()
              load in the allowed postprocceses controls, and the order to run post processes in
     SearchRequest newSearchRequest()
              Ask for new SearchRequest object to be made.
     SearchRequest newSearchRequest(java.lang.String QueryID)
              Ask for new SearchRequest object to be made.
     SearchRequest newSearchRequest(java.lang.String QueryID, java.lang.String query)
              Ask for new SearchRequest object to be made, instantiated using the specified query id, and that the specified query should be parsed.
     void runMatching(SearchRequest srq)
              Runs the weighting and matching stage - this the main entry into the rest of the Terrier framework.
     void runPostFilters(SearchRequest srq)
              Runs the PostFilter modules in order added.
     void runPostProcessing(SearchRequest srq)
              Runs the PostProcessing modules in order added.
     void runPreProcessing(SearchRequest srq)
              runPreProcessing
    protected  void setDefaults(Request srq)
              Set the default values for the controls of this new search request
     void setProperties(java.util.Properties p)
              Set all these properties.
     void setProperty(java.lang.String key, java.lang.String value)
              Provide a common interface for changing property values.
    protected  void useThisIndex(Index i)
              use the index specified for the Manager
     
    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_POSTPROCESS

    public static final java.lang.String NAMESPACE_POSTPROCESS
    The default namespace for PostProcesses to be loaded from

    See Also:
    Constant Field Values

    NAMESPACE_PREPROCESS

    public static final java.lang.String NAMESPACE_PREPROCESS
    The default namespace for PreProcesses to be loaded from

    See Also:
    Constant Field Values

    NAMESPACE_POSTFILTER

    public static final java.lang.String NAMESPACE_POSTFILTER
    The default namespace for PostFilters to be loaded from

    See Also:
    Constant Field Values

    NAMESPACE_MATCHING

    public static final java.lang.String NAMESPACE_MATCHING
    The default namespace for Matching models to be loaded from

    See Also:
    Constant Field Values

    NAMESPACE_WEIGHTING

    public static final java.lang.String NAMESPACE_WEIGHTING
    The default namespace for Weighting models to be loaded from

    See Also:
    Constant Field Values

    Cache_Matching

    protected java.util.Map<Index,java.util.Map<java.lang.String,Matching>> Cache_Matching
    Cache loaded Matching models per Index in this map


    Cache_PostProcess

    protected java.util.Map<java.lang.String,PostProcess> Cache_PostProcess
    Cache loaded PostProcess models in this map


    Cache_PreProcess

    protected java.util.Map<java.lang.String,Process> Cache_PreProcess
    Cache loaded PostProcess models in this map


    Cache_PostFilter

    protected java.util.Map<java.lang.String,PostFilter> Cache_PostFilter
    Cache loaded PostFitler models in this map


    tpa

    protected TermPipelineAccessor tpa
    TermPipeline processing


    index

    protected Index index
    The index this querying comes from


    Allowed_Controls

    protected java.util.Set<java.lang.String> Allowed_Controls
    This contains a list of controls that may be set in the querying API


    Default_Controls

    protected java.util.Map<java.lang.String,java.lang.String> Default_Controls
    This contains the mapping of controls and their values that should be set identially for each query created by this Manager


    Defaults_Size

    protected int Defaults_Size
    How many default controls exist. Directly corresponds to Default_Controls.size()


    PostProcesses_Order

    protected java.lang.String[] PostProcesses_Order
    An ordered list of post process names. The controls at the same index in the PostProcesses_Controls list turn on the post process in this list.


    PostProcesses_Controls

    protected java.lang.String[][] PostProcesses_Controls
    A 2d array, contains (on 2nd level) the list of controls that turn on the PostProcesses at the same 1st level place on PostProcesses_Order


    PreProcesses_Order

    protected java.lang.String[] PreProcesses_Order
    An ordered list of post process names. The controls at the same index in the PostProcesses_Controls list turn on the post process in this list.


    PreProcesses_Controls

    protected java.lang.String[][] PreProcesses_Controls
    A 2d array, contains (on 2nd level) the list of controls that turn on the PostProcesses at the same 1st level place on PostProcesses_Order


    PostFilters_Order

    protected java.lang.String[] PostFilters_Order
    An ordered list of post filters names. The controls at the same index in the PostFilters_Controls list turn on the post process in this list.


    PostFilters_Controls

    protected java.lang.String[][] PostFilters_Controls
    A 2d array, contains (on 2nd level) the list of controls that turn on the PostFilters at the same 1st level place on PostFilters_Order


    pipelineOutput

    protected java.lang.String pipelineOutput
    This class is used as a TermPipelineAccessor, and this variable stores the result of the TermPipeline run for that term.


    CACHING_FILTERS

    protected boolean CACHING_FILTERS

    MATCH_EMPTY_QUERY

    protected final boolean MATCH_EMPTY_QUERY

    tinySingleStringArray

    protected static final java.lang.String[] tinySingleStringArray

    tinyDoubleStringArray

    protected static final java.lang.String[][] tinyDoubleStringArray
    Constructor Detail

    Manager

    public Manager()
    Default constructor. Use the default index

    Since:
    2.0

    Manager

    public Manager(Index _index)
    Construct a Manager using the specified Index Throws IllegalArgumentException if the specified index is null

    Parameters:
    _index - The index to use in this manage
    Method Detail

    useThisIndex

    protected void useThisIndex(Index i)
    use the index specified for the Manager


    load_controls_allowed

    protected void load_controls_allowed()
    load in the controls that user is allowed to set


    load_controls_default

    protected void load_controls_default()
    load in the control defaults


    load_postprocess_controls

    protected void load_postprocess_controls()
    load in the allowed postprocceses controls, and the order to run post processes in


    load_preprocess_controls

    protected void load_preprocess_controls()
    load in the allowed postprocceses controls, and the order to run post processes in


    load_postfilters_controls

    protected void load_postfilters_controls()
    load in the allowed post filter controls, and the order to run post processes in


    load_pipeline

    protected void load_pipeline()
    load in the term pipeline


    newSearchRequest

    public SearchRequest newSearchRequest()
    Ask for new SearchRequest object to be made. This is internally a Request object


    newSearchRequest

    public SearchRequest newSearchRequest(java.lang.String QueryID)
    Ask for new SearchRequest object to be made. This is internally a Request object

    Parameters:
    QueryID - The request should be identified by QueryID

    newSearchRequest

    public SearchRequest newSearchRequest(java.lang.String QueryID,
                                          java.lang.String query)
    Ask for new SearchRequest object to be made, instantiated using the specified query id, and that the specified query should be parsed.

    Parameters:
    QueryID - The request should be identified by QueryID
    query - The actual user query
    Returns:
    The fully init'd search request for use in the manager
    Since:
    2.0

    setDefaults

    protected void setDefaults(Request srq)
    Set the default values for the controls of this new search request

    Parameters:
    srq - The search request to have the default set to. This is done using the Default_Controls table, which is loaded by the load_controls_default method. The default are set in the properties file, by the querying.default.controls

    getIndex

    public Index getIndex()
    Returns the index used by the manager. It is used for matching and possibly post-processing.

    Returns:
    Index the index used by the manager.

    setProperty

    public void setProperty(java.lang.String key,
                            java.lang.String value)
    Provide a common interface for changing property values.

    Parameters:
    key - Key of property to set
    value - Value of property to set

    setProperties

    public void setProperties(java.util.Properties p)
    Set all these properties. Implemented using setProperty(String,String).

    Parameters:
    p - All properties to set

    runPreProcessing

    public void runPreProcessing(SearchRequest srq)
    runPreProcessing


    runMatching

    public void runMatching(SearchRequest srq)
    Runs the weighting and matching stage - this the main entry into the rest of the Terrier framework.

    Parameters:
    srq - the current SearchRequest object.

    runPostProcessing

    public void runPostProcessing(SearchRequest srq)
    Runs the PostProcessing modules in order added. PostProcess modules alter the resultset. Examples might be query expansions which completely replaces the resultset.

    Parameters:
    srq - the current SearchRequest object.

    runPostFilters

    public void runPostFilters(SearchRequest srq)
    Runs the PostFilter modules in order added. PostFilter modules filter the resultset. Examples might be removing results that don't have a hostname ending in the required postfix (site), or document ids that don't match a pattern (scope).

    Parameters:
    srq - the current SearchRequest object.

    getMatchingModel

    protected Matching getMatchingModel(Request rq)
    Returns the matching model indicated to be used, based on the Index and the Matching name specified in the passed Request object. Caches already instantiaed matching models in Map Cache_Matching. If the matching model name doesn't contain '.', then NAMESPACE_MATCHING is prefixed to the name.

    Parameters:
    rq - The request indicating the Matching class, and the corresponding instance to use
    Returns:
    null If an error occurred obtaining the matching class

    getWeightingModel

    protected Model getWeightingModel(Request rq)
    Returns the weighting model requested by the Reqes from the WeightingModel factory.

    Parameters:
    rq - The name of the weighting model to instantiate

    getPostProcessModule

    protected PostProcess getPostProcessModule(java.lang.String Name)
    Returns the PostProcess named Name. Caches already instantiaed classes in Hashtable Cache_PostProcess. If the post process class name doesn't contain '.', then NAMESPACE_POSTPROCESS is prefixed to the name.

    Parameters:
    Name - The name of the post process to return.

    getPreProcessModule

    protected Process getPreProcessModule(java.lang.String Name)
    Returns the PostProcess named Name. Caches already instantiaed classes in Hashtable Cache_PostProcess. If the post process class name doesn't contain '.', then NAMESPACE_PREPROCESS is prefixed to the name.

    Parameters:
    Name - The name of the post process to return.

    getPostFilterModule

    protected PostFilter getPostFilterModule(java.lang.String Name)
    Returns the post filter class named ModelName. Caches already instantiaed matching models in Hashtable Cache_PostFilter. If the matching model name doesn't contain '.', then NAMESPACE_POSTFILTER is prefixed to the name.

    Parameters:
    Name - The name of the post filter to return

    getInfo

    public java.lang.String getInfo(SearchRequest srq)
    Returns information about the weighting models and the post processors used for the given search request.

    Parameters:
    srq - the search request for which we obtain the information.
    Returns:
    String information about the weighting models and the post processors used.


    Terrier 3.5. Copyright © 2004-2011 University of Glasgow