|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.matching.PostingListManager
public class PostingListManager
The PostingListManager is reponsible for opening the appropriate posting lists IterablePosting
given
the MatchingQueryTerms object. Moreover, it knows how each Posting should be scored.
Plugins are also supported by PostingListManager. Each plugin class should implement the PostingListManagerPlugin interface, and be named explicitly in the matching.postinglist.manager.plugins property.
Properties:
Example Usage
Following code shows how term-at-a-time matching may occur using the PostingListManager:MatchingQueryTerms mqt; Index index; PostingListManager plm = new PostingListManager(index, index.getCollectionStatistics(), mqt); plm.prepare(false); for(int term = 0;term < plm.size(); term++) { IterablePosting ip = plm.get(term); while(ip.next() != IterablePosting.EOL) { double score = plm.score(term); int id = ip.getId(); } } plm.close();
Matching
Nested Class Summary | |
---|---|
static interface |
PostingListManager.PostingListManagerPlugin
Interface for plugins to further alter the posting lists managed by the PostingListManager |
Field Summary | |
---|---|
protected CollectionStatistics |
collectionStatistics
statistics of the collection |
protected static boolean |
IGNORE_LOW_IDF_TERMS
A property that enables to ignore the terms with a low IDF. |
protected Index |
index
underlying index |
protected InvertedIndex |
invertedIndex
inverted index of the index |
protected Lexicon<java.lang.String> |
lexicon
lexicon for the index |
protected static org.apache.log4j.Logger |
logger
|
protected int |
numTerms
number of terms |
protected java.util.List<WeightingModel[]> |
termModels
weighting models for each term |
protected java.util.List<IterablePosting> |
termPostings
posting lists for each term |
protected java.util.List<EntryStatistics> |
termStatistics
EntryStatistics for each term |
protected java.util.List<java.lang.String> |
termStrings
String form for each term |
Constructor Summary | |
---|---|
protected |
PostingListManager(Index _index,
CollectionStatistics cs)
Create a posting list manager for the given index and statistics |
|
PostingListManager(Index _index,
CollectionStatistics _cs,
MatchingQueryTerms mqt)
Create a posting list manager for the given index and statistics, and populated using the specified MatchingQueryTerms. |
Method Summary | |
---|---|
void |
addSingleTerm(java.lang.String queryTerm,
double weight,
EntryStatistics entryStats,
WeightingModel[] wmodels)
Add a single term to those to be matched for this query. |
void |
addSingleTermAlternatives(java.lang.String[] terms,
java.lang.String stringForm,
double weight,
EntryStatistics[] entryStats,
WeightingModel[] wmodels)
Adds a synonym group to the matching process. |
void |
addSingleTermAlternatives(java.lang.String[] terms,
java.lang.String stringForm,
double weight,
EntryStatistics entryStats,
WeightingModel[] wmodels)
Adds a synonym group to the matching process. |
void |
close()
|
int |
getNumTerms()
Returns the number of postings lists (that are terms) for this query |
IterablePosting |
getPosting(int i)
Returns the IterablePosting corresponding to the specified term |
EntryStatistics |
getStatistics(int i)
Returns the EntryStatistics corresponding to the specified term |
java.lang.String |
getTerm(int i)
|
static EntryStatistics |
mergeStatistics(EntryStatistics[] entryStats)
Knows how to merge several EntryStatistics for a single effective term |
void |
prepare(boolean firstMove)
Counts the number of terms active. |
double |
score(int i)
Returns the score using all weighting models for the current posting of the specified term |
int |
size()
Returns the number of posting lists for this query |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
protected static boolean IGNORE_LOW_IDF_TERMS
protected final java.util.List<IterablePosting> termPostings
protected final java.util.List<WeightingModel[]> termModels
protected final java.util.List<EntryStatistics> termStatistics
protected final java.util.List<java.lang.String> termStrings
protected int numTerms
protected Index index
protected Lexicon<java.lang.String> lexicon
protected InvertedIndex invertedIndex
protected CollectionStatistics collectionStatistics
Constructor Detail |
---|
protected PostingListManager(Index _index, CollectionStatistics cs) throws java.io.IOException
java.io.IOException
public PostingListManager(Index _index, CollectionStatistics _cs, MatchingQueryTerms mqt) throws java.io.IOException
_index
- - index to obtain postings from_cs
- - collection statistics to obtainmqt
- - MatchingQueryTerms object calculated for the query
java.io.IOException
Method Detail |
---|
public void addSingleTerm(java.lang.String queryTerm, double weight, EntryStatistics entryStats, WeightingModel[] wmodels) throws java.io.IOException
queryTerm
- String form of the query termweight
- influence of this query term in scoringentryStats
- statistics to be used for this query term. If null, these will be obtained
from the local Lexiconwmodels
- weighting models to be applied for this query term
java.io.IOException
public static EntryStatistics mergeStatistics(EntryStatistics[] entryStats)
public void addSingleTermAlternatives(java.lang.String[] terms, java.lang.String stringForm, double weight, EntryStatistics[] entryStats, WeightingModel[] wmodels) throws java.io.IOException
terms
- String of the terms in the synonym groupweight
- influence of this synonym group during retrievalentryStats
- statistics of the terms in the synonym group. If null, these will
be obtained from the local Lexicon.wmodels
- WeightingModels for the synonym group (NOT one per member).
java.io.IOException
public void addSingleTermAlternatives(java.lang.String[] terms, java.lang.String stringForm, double weight, EntryStatistics entryStats, WeightingModel[] wmodels) throws java.io.IOException
terms
- String of the terms in the synonym groupweight
- influence of this synonym group during retrievalentryStats
- statistics of the whole synonym group. If null, these will
be obtained from the local Lexicon for all terms in the group will be combined using mergeStatistics()wmodels
- WeightingModels for the synonym group (NOT one per member).
java.io.IOException
public void prepare(boolean firstMove) throws java.io.IOException
firstMove
- move all postings to the start?
java.io.IOException
public EntryStatistics getStatistics(int i)
i
- term to obtain statistics for
public IterablePosting getPosting(int i)
i
- term to obtain the posting list for
public int size()
public int getNumTerms()
public double score(int i)
i
- Which term to score
public void close() throws java.io.IOException
close
in interface java.io.Closeable
java.io.IOException
public java.lang.String getTerm(int i)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |