public class PostingListManager extends Object implements Closeable
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
Modifier and Type | Class and Description |
---|---|
static interface |
PostingListManager.PostingListManagerPlugin
Interface for plugins to further alter the posting lists managed by the PostingListManager
|
Modifier and Type | Field and Description |
---|---|
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 PostingIndex<Pointer> |
invertedIndex
inverted index of the index
|
protected Lexicon<String> |
lexicon
lexicon for the index
|
protected static org.slf4j.Logger |
logger |
protected gnu.trove.TIntArrayList |
matchOnTerms |
protected long |
negRequiredBitMask |
protected gnu.trove.TIntArrayList |
nonMatchOnTerms |
protected int |
numTerms
number of terms
|
protected static PostingListManager.PostingListManagerPlugin[] |
plugins |
protected long |
requiredBitMask
which terms are positively required to match in retrieved documents
|
protected gnu.trove.TDoubleArrayList |
termKeyFreqs
key (query) frequencies for each term
|
protected List<WeightingModel> |
termModels
weighting models for each term
|
protected List<IterablePosting> |
termPostings
posting lists for each term
|
protected List<EntryStatistics> |
termStatistics
EntryStatistics for each term
|
protected List<String> |
termStrings
String form for each term
|
protected List<Set<String>> |
termTags
String form for each term
|
Modifier | Constructor and Description |
---|---|
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.
|
|
PostingListManager(Index _index,
CollectionStatistics _cs,
MatchingQueryTerms mqt,
boolean splitSynonyms,
String scoringTag,
String additionalTag)
Create a posting list manager for the given index and statistics, and populated using the specified
MatchingQueryTerms.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
double |
getKeyFrequency(int i) |
int[] |
getMatchingTerms()
Returns the indices of the terms that are considered (i.e.
|
long |
getNegRequiredBitMask() |
int[] |
getNonMatchingTerms()
Returns the indices of the terms that must be called through assignScore() but not actually used to match documents.
|
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
|
long |
getRequiredBitMask() |
EntryStatistics |
getStatistics(int i)
Returns the EntryStatistics corresponding to the specified term
|
Set<String> |
getTags(int i) |
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
|
protected static final org.slf4j.Logger logger
protected static boolean IGNORE_LOW_IDF_TERMS
protected static PostingListManager.PostingListManagerPlugin[] plugins
protected final List<IterablePosting> termPostings
protected final List<WeightingModel> termModels
protected final List<EntryStatistics> termStatistics
protected final gnu.trove.TIntArrayList matchOnTerms
protected final gnu.trove.TIntArrayList nonMatchOnTerms
protected final gnu.trove.TDoubleArrayList termKeyFreqs
protected int numTerms
protected Index index
protected PostingIndex<Pointer> invertedIndex
protected CollectionStatistics collectionStatistics
protected long requiredBitMask
protected long negRequiredBitMask
protected PostingListManager(Index _index, CollectionStatistics cs) throws IOException
IOException
public PostingListManager(Index _index, CollectionStatistics _cs, MatchingQueryTerms mqt) throws IOException
_index
- - index to obtain postings from_cs
- - collection statistics to obtainmqt
- - MatchingQueryTerms object calculated for the queryIOException
public PostingListManager(Index _index, CollectionStatistics _cs, MatchingQueryTerms mqt, boolean splitSynonyms, String scoringTag, String additionalTag) throws IOException
_index
- - index to obtain postings from_cs
- - collection statistics to obtainmqt
- - MatchingQueryTerms object calculated for the querysplitSynonyms
- - allows the splitting of synonym groups (i.e. singleTermAlternatives) to be disabledIOException
public static EntryStatistics mergeStatistics(EntryStatistics[] entryStats)
public void prepare(boolean firstMove) throws IOException
firstMove
- move all postings to the start?IOException
public EntryStatistics getStatistics(int i)
i
- term to obtain statistics forpublic IterablePosting getPosting(int i)
i
- term to obtain the posting list forpublic int size()
public int getNumTerms()
public int[] getMatchingTerms()
public int[] getNonMatchingTerms()
public double score(int i)
i
- Which term to scorepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long getRequiredBitMask()
public long getNegRequiredBitMask()
public String getTerm(int i)
public double getKeyFrequency(int i)
Terrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow