org.terrier.matching
Class BaseMatching

java.lang.Object
  extended by org.terrier.matching.BaseMatching
All Implemented Interfaces:
Matching
Direct Known Subclasses:
Full, Full, FullNoPLM, FullNoPLM

public abstract class BaseMatching
extends java.lang.Object
implements Matching

Performs the matching of documents with a query, by first assigning scores to documents for each query term and modifying these scores with the appropriate modifiers. Then, a series of document score modifiers are applied if necessary.

Properties

Since:
3.0
Author:
Vassilis Plachouras, Craig Macdonald, Nicola Tonellotto

Field Summary
protected  CollectionStatistics collectionStatistics
          The collection statistics
protected  java.util.List<DocumentScoreModifier> documentModifiers
          Contains the document score modifiers to be applied for a query.
protected static java.lang.String dsmNamespace
          the default namespace for the document score modifiers that are specified in the properties file.
protected static boolean IGNORE_LOW_IDF_TERMS
          A property that enables to ignore the terms with a low IDF.
protected  Index index
          The index used for retrieval.
protected  PostingIndex<BitIndexPointer> invertedIndex
          The inverted file.
protected  Lexicon<java.lang.String> lexicon
          The lexicon used.
protected static org.apache.log4j.Logger logger
          the logger for this class
protected static boolean MATCH_EMPTY_QUERY
          A property that when it is true, it allows matching all documents to an empty query.
protected  int numberOfRetrievedDocuments
          The number of retrieved documents for a query.
protected  java.util.List<java.util.Map.Entry<java.lang.String,LexiconEntry>> queryTermsToMatchList
           
protected  ResultSet resultSet
          The result set.
protected static int RETRIEVED_SET_SIZE
          The maximum number of documents in the final retrieved set.
protected  long totalTime
           
protected  WeightingModel[][] wm
           
 
Constructor Summary
protected BaseMatching()
           
  BaseMatching(Index _index)
          Constructs an instance of the BaseMatching
 
Method Summary
protected  void finalise(MatchingQueryTerms queryTerms)
           
abstract  java.lang.String getInfo()
          Return a human readable description of this Matching class
 long getTotalTime()
          get the total time
protected  void initialise(MatchingQueryTerms queryTerms)
           
protected  void initialisePostings(MatchingQueryTerms queryTerms)
           
abstract  ResultSet match(java.lang.String queryNumber, MatchingQueryTerms queryTerms)
          Get a ResultSet for the given query terms.
 void setCollectionStatistics(CollectionStatistics cs)
          Update the collection statistics being used by this matching instance
 void updateEndTime(long t)
          Update the end time.
 void updateStartTime(long t)
          Update the start time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

totalTime

protected long totalTime

logger

protected static final org.apache.log4j.Logger logger
the logger for this class


dsmNamespace

protected static java.lang.String dsmNamespace
the default namespace for the document score modifiers that are specified in the properties file.


RETRIEVED_SET_SIZE

protected static int RETRIEVED_SET_SIZE
The maximum number of documents in the final retrieved set. It corresponds to the property matching.retrieved_set_size. The default value is 1000, however, setting the property to 0 will return all matched documents.


IGNORE_LOW_IDF_TERMS

protected static boolean IGNORE_LOW_IDF_TERMS
A property that enables to ignore the terms with a low IDF. Corresponds to property ignore.low.idf.terms. Defaults to true. This can cause some query terms to be omitted in small corpora.


MATCH_EMPTY_QUERY

protected static boolean MATCH_EMPTY_QUERY
A property that when it is true, it allows matching all documents to an empty query. In this case the ordering of documents is random. More specifically, it is the ordering of documents in the document index.


numberOfRetrievedDocuments

protected int numberOfRetrievedDocuments
The number of retrieved documents for a query.


index

protected Index index
The index used for retrieval.


lexicon

protected Lexicon<java.lang.String> lexicon
The lexicon used.


invertedIndex

protected PostingIndex<BitIndexPointer> invertedIndex
The inverted file.


collectionStatistics

protected CollectionStatistics collectionStatistics
The collection statistics


resultSet

protected ResultSet resultSet
The result set.


documentModifiers

protected java.util.List<DocumentScoreModifier> documentModifiers
Contains the document score modifiers to be applied for a query.


wm

protected WeightingModel[][] wm

queryTermsToMatchList

protected java.util.List<java.util.Map.Entry<java.lang.String,LexiconEntry>> queryTermsToMatchList
Constructor Detail

BaseMatching

protected BaseMatching()

BaseMatching

public BaseMatching(Index _index)
Constructs an instance of the BaseMatching

Parameters:
_index -
Method Detail

updateStartTime

public void updateStartTime(long t)
Update the start time

Parameters:
t -

updateEndTime

public void updateEndTime(long t)
Update the end time.

Parameters:
t -

getTotalTime

public long getTotalTime()
get the total time

Returns:
long

initialisePostings

protected void initialisePostings(MatchingQueryTerms queryTerms)

initialise

protected void initialise(MatchingQueryTerms queryTerms)

finalise

protected void finalise(MatchingQueryTerms queryTerms)

setCollectionStatistics

public void setCollectionStatistics(CollectionStatistics cs)
Update the collection statistics being used by this matching instance

Specified by:
setCollectionStatistics in interface Matching
Parameters:
cs - CollectionStatistics to use during matching

getInfo

public abstract java.lang.String getInfo()
Return a human readable description of this Matching class

Specified by:
getInfo in interface Matching

match

public abstract ResultSet match(java.lang.String queryNumber,
                                MatchingQueryTerms queryTerms)
                         throws java.io.IOException
Get a ResultSet for the given query terms.

Specified by:
match in interface Matching
Parameters:
queryNumber - - some ID of the query
queryTerms - - query terms to match
Returns:
ResultSet - the matched results
Throws:
java.io.IOException - if a problem occurs during matching


Terrier 3.5. Copyright © 2004-2011 University of Glasgow