Package org.terrier.matching
Class BaseMatching
- java.lang.Object
-
- org.terrier.matching.BaseMatching
-
- All Implemented Interfaces:
Matching
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
- matching.retrieved_set_size - The maximum number of documents in the final retrieved set. The default value is 1000, however, setting the property to 0 will return all matched documents.
- ignore.low.idf.terms - A property that enables to ignore the terms with a low IDF.
- match.empty.query - whether an empty query should return all documents. Defaults to false.
- Since:
- 3.0
- Author:
- Vassilis Plachouras, Craig Macdonald, Nicola Tonellotto
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
BaseMatching.MatchingState
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BASE_MATCHING_TAG
protected CollectionStatistics
collectionStatistics
The collection statisticsprotected 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<Pointer>
invertedIndex
The inverted file.protected Lexicon<java.lang.String>
lexicon
The lexicon used.protected static org.slf4j.Logger
logger
the logger for this classprotected static boolean
MATCH_EMPTY_QUERY
A property that when it is true, it allows matching all documents to an empty query.static java.lang.String
NONMATCHING_TAG
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseMatching()
BaseMatching(Index _index)
Constructs an instance of the BaseMatching
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
finalise(BaseMatching.MatchingState state)
abstract java.lang.String
getInfo()
Return a human readable description of this Matching classprotected BaseMatching.MatchingState
initialise(MatchingQueryTerms queryTerms)
protected void
initialisePostings(BaseMatching.MatchingState state)
protected BaseMatching.MatchingState
initialiseState()
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
-
-
-
Field Detail
-
BASE_MATCHING_TAG
public static final java.lang.String BASE_MATCHING_TAG
- See Also:
- Constant Field Values
-
NONMATCHING_TAG
public static final java.lang.String NONMATCHING_TAG
- See Also:
- Constant Field Values
-
logger
protected static final org.slf4j.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.
-
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.
-
index
protected Index index
The index used for retrieval.
-
lexicon
protected Lexicon<java.lang.String> lexicon
The lexicon used.
-
invertedIndex
protected PostingIndex<Pointer> invertedIndex
The inverted file.
-
collectionStatistics
protected CollectionStatistics collectionStatistics
The collection statistics
-
documentModifiers
protected java.util.List<DocumentScoreModifier> documentModifiers
Contains the document score modifiers to be applied for a query.
-
-
Constructor Detail
-
BaseMatching
protected BaseMatching()
-
BaseMatching
public BaseMatching(Index _index)
Constructs an instance of the BaseMatching- Parameters:
_index
-
-
-
Method Detail
-
initialiseState
protected BaseMatching.MatchingState initialiseState()
-
initialisePostings
protected void initialisePostings(BaseMatching.MatchingState state)
-
initialise
protected BaseMatching.MatchingState initialise(MatchingQueryTerms queryTerms)
-
finalise
protected void finalise(BaseMatching.MatchingState state)
-
setCollectionStatistics
public void setCollectionStatistics(CollectionStatistics cs)
Update the collection statistics being used by this matching instance- Specified by:
setCollectionStatistics
in interfaceMatching
- Parameters:
cs
- CollectionStatistics to use during matching
-
getInfo
public abstract java.lang.String getInfo()
Return a human readable description of this Matching class
-
match
public abstract ResultSet match(java.lang.String queryNumber, MatchingQueryTerms queryTerms) throws java.io.IOException
Get a ResultSet for the given query terms.
-
-