Package org.terrier.structures.postings
Class PhraseIterablePosting
- java.lang.Object
-
- org.terrier.structures.postings.IterablePostingImpl
-
- org.terrier.structures.postings.ANDIterablePosting
-
- org.terrier.structures.postings.PhraseIterablePosting
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,BlockPosting
,IterablePosting
,Posting
public class PhraseIterablePosting extends ANDIterablePosting implements BlockPosting
Implementation of an IterablePosting for block indices that returns only documents that match a multi-term phase.- Since:
- 3.5
- Author:
- Craig Macdonald
-
-
Field Summary
-
Fields inherited from class org.terrier.structures.postings.ANDIterablePosting
currentId, frequency, ips, termCount
-
Fields inherited from interface org.terrier.structures.postings.IterablePosting
END_OF_LIST, EOL
-
-
Constructor Summary
Constructors Constructor Description PhraseIterablePosting(IterablePosting[] _ips, EntryStatistics[] _p, boolean recordPositions)
PhraseIterablePosting(IterablePosting[] _ips, Pointer[] _p, boolean recordPositions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WritablePosting
asWritablePosting()
Copy this posting to one free of an iterator.protected boolean
calculateFrequency()
returns true if the document matchesstatic IterablePosting
createPhrasePostingList(java.lang.String[] terms, Lexicon<java.lang.String> lex, PostingIndex<Pointer> invIndex, boolean savePositions)
static IterablePosting
createPhrasePostingList(Pointer[] ps, PostingIndex<Pointer> invIndex, boolean savePositions)
int[]
getPositions()
Return the positions of occurrences of the term in the current document.-
Methods inherited from class org.terrier.structures.postings.ANDIterablePosting
close, endOfPostings, getDocumentLength, getFrequency, getId, next, next
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.terrier.structures.postings.Posting
getDocumentLength, getFrequency, getId, setId
-
-
-
-
Constructor Detail
-
PhraseIterablePosting
public PhraseIterablePosting(IterablePosting[] _ips, EntryStatistics[] _p, boolean recordPositions) throws java.io.IOException
- Throws:
java.io.IOException
-
PhraseIterablePosting
public PhraseIterablePosting(IterablePosting[] _ips, Pointer[] _p, boolean recordPositions) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
asWritablePosting
public WritablePosting asWritablePosting()
Description copied from interface:Posting
Copy this posting to one free of an iterator. Kind of like a clone.- Specified by:
asWritablePosting
in interfacePosting
- Overrides:
asWritablePosting
in classANDIterablePosting
- Returns:
- an identical posting, but which can be manipulated free of this iterator
-
calculateFrequency
protected boolean calculateFrequency()
Description copied from class:ANDIterablePosting
returns true if the document matches- Overrides:
calculateFrequency
in classANDIterablePosting
-
getPositions
public int[] getPositions()
Description copied from interface:BlockPosting
Return the positions of occurrences of the term in the current document.- Specified by:
getPositions
in interfaceBlockPosting
- Returns:
- the positions of occurrences of the term in the current document.
-
createPhrasePostingList
public static IterablePosting createPhrasePostingList(Pointer[] ps, PostingIndex<Pointer> invIndex, boolean savePositions) throws java.io.IOException
- Throws:
java.io.IOException
-
createPhrasePostingList
public static IterablePosting createPhrasePostingList(java.lang.String[] terms, Lexicon<java.lang.String> lex, PostingIndex<Pointer> invIndex, boolean savePositions) throws java.io.IOException
- Throws:
java.io.IOException
-
-