org.terrier.querying
Class Decorate

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

public class Decorate
extends Object
implements PostProcess, PostFilter

This class decorates a result set with metadata. This metadata can be highlighted, can have a query biased summary created, and also be escaped for display in another format. Controls:

Properties:

Since:
3.0
Author:
Craig Macdonald, Vassilis Plachouras, Ben He

Field Summary
protected static Pattern cleanQuery
           
protected static String[] CONTROL_VALUE_DELIMS
          delimiters for breaking down the values of controls further
protected static Pattern controlNonVisibleCharacters
           
protected  Matcher controlNonVisibleCharactersMatcher
           
protected static StringTools.ESCAPE defaultEscape
          what is the default escape sequence
protected  Set<String> earlyKeys
           
protected  Set<String> emphasisKeys
           
protected  Map<String,StringTools.ESCAPE> escapeKeys
           
protected  Pattern highlight
          highlighting pattern for the current query
protected  gnu.trove.TObjectIntHashMap<String> keys
           
protected  LRUMap<Integer,String[]> metaCache
          The cache used for the meta data.
protected  MetaIndex metaIndex
          The meta index server.
protected  String[] metaKeys
           
protected  String[] qTerms
          query terms of the current query
protected  Summariser summariser
           
protected  Set<String> summaryKeys
           
 
Fields inherited from interface org.terrier.querying.PostFilter
FILTER_ADJUSTED, FILTER_OK, FILTER_REMOVE
 
Constructor Summary
Decorate()
           
 
Method Summary
protected  boolean checkControl(String control_name, SearchRequest srq)
           
 byte filter(Manager m, SearchRequest q, ResultSet rs, int rank, int docid)
          Called for each result in the resultset, used to filter out unwanted results.
protected  Pattern generateEmphasisPattern(String[] _qTerms)
          Creates a regular expression pattern to highlight query terms metadata.
 String getInfo()
          Returns the name of the post processor.
protected  String[] getMetadata(String[] metaKeys, int docid)
           
protected  String[][] getMetadata(String[] metaKeys, int[] docids)
           
 void new_query(Manager m, SearchRequest q, ResultSet rs)
          Called before the processing of a resultset using this PostFilter is applied.
 void process(Manager manager, SearchRequest q)
          decoration at the postprocess stage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTROL_VALUE_DELIMS

protected static final String[] CONTROL_VALUE_DELIMS
delimiters for breaking down the values of controls further


metaCache

protected LRUMap<Integer,String[]> metaCache
The cache used for the meta data. Implements a Least-Recently-Used policy for retaining the most recently accessed metadata.


metaIndex

protected MetaIndex metaIndex
The meta index server. It is provided by the manager.


controlNonVisibleCharacters

protected static final Pattern controlNonVisibleCharacters

defaultEscape

protected static final StringTools.ESCAPE defaultEscape
what is the default escape sequence


controlNonVisibleCharactersMatcher

protected Matcher controlNonVisibleCharactersMatcher

cleanQuery

protected static final Pattern cleanQuery

highlight

protected Pattern highlight
highlighting pattern for the current query


qTerms

protected String[] qTerms
query terms of the current query


keys

protected gnu.trove.TObjectIntHashMap<String> keys

summaryKeys

protected Set<String> summaryKeys

emphasisKeys

protected Set<String> emphasisKeys

escapeKeys

protected Map<String,StringTools.ESCAPE> escapeKeys

earlyKeys

protected Set<String> earlyKeys

summariser

protected Summariser summariser

metaKeys

protected String[] metaKeys
Constructor Detail

Decorate

public Decorate()
Method Detail

new_query

public void new_query(Manager m,
                      SearchRequest q,
                      ResultSet rs)
Called before the processing of a resultset using this PostFilter is applied. Can be used to save information for the duration of the query.

Specified by:
new_query in interface PostFilter
Parameters:
m - The manager controlling this query
q - The search request being processed
rs - the resultset that is being iterated through

filter

public byte filter(Manager m,
                   SearchRequest q,
                   ResultSet rs,
                   int rank,
                   int docid)
Called for each result in the resultset, used to filter out unwanted results.

Specified by:
filter in interface PostFilter
Parameters:
m - The manager controlling this query
q - The search request being processed
rank - which array index (rank) in the resultset have we reached
docid - The docid of the currently being procesed result.

process

public void process(Manager manager,
                    SearchRequest q)
decoration at the postprocess stage. only decorate if required for future postfilter or postprocesses.

Specified by:
process in interface Process
Parameters:
manager - The manager instance handling this search session.
q - the current query being processed

getMetadata

protected String[] getMetadata(String[] metaKeys,
                               int docid)

getMetadata

protected String[][] getMetadata(String[] metaKeys,
                                 int[] docids)

generateEmphasisPattern

protected Pattern generateEmphasisPattern(String[] _qTerms)
Creates a regular expression pattern to highlight query terms metadata.

Parameters:
_qTerms - query terms
Returns:
Pattern to apply

checkControl

protected boolean checkControl(String control_name,
                               SearchRequest srq)

getInfo

public String getInfo()
Returns the name of the post processor.

Specified by:
getInfo in interface Process
Returns:
String the name of the post processor.


Terrier 3.6. Copyright © 2004-2011 University of Glasgow