Class BasicPostingImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int dl  
      protected int id
      id of the posting
      protected int tf
      frequency of this posting
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicPostingImpl()
      Empty constructor - needed for Writable
      BasicPostingImpl​(int docid, int frequency)
      Constructor that sets both id and frequency
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      WritablePosting asWritablePosting()
      Copy this posting to one free of an iterator.
      int getDocumentLength()
      Returns 0
      int getFrequency()
      Return the frequency of the term in the current document, in tokens.
      int getId()
      Return the id of the current posting.
      void readFields​(java.io.DataInput in)
      Reads the a single posting (not an iterable posting - use BitPostingIndex for that)
      void setDocumentLength​(int l)
      Set the length of the document of the current posting in tokens.
      void setId​(int _id)
      Set the id of this posting
      void setTf​(int tf)
      Set the term frequency in the document
      java.lang.String toString()
      Makes a human readable form of this posting
      void write​(java.io.DataOutput out)
      Writes the current posting (not an iterable posting - use DirectInvertedOutputStream for that).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • dl

        protected int dl
      • id

        protected int id
        id of the posting
      • tf

        protected int tf
        frequency of this posting
    • Constructor Detail

      • BasicPostingImpl

        public BasicPostingImpl()
        Empty constructor - needed for Writable
      • BasicPostingImpl

        public BasicPostingImpl​(int docid,
                                int frequency)
        Constructor that sets both id and frequency
    • Method Detail

      • getId

        public final int getId()
        Return the id of the current posting. For the inverted index, this is the current docid; for the direct index it corresponds to the current term id.
        Specified by:
        getId in interface Posting
        Returns:
        id of the posting.
      • getFrequency

        public final int getFrequency()
        Return the frequency of the term in the current document, in tokens.
        Specified by:
        getFrequency in interface Posting
        Returns:
        frequency of the term in the current document, in tokens.
      • readFields

        public void readFields​(java.io.DataInput in)
                        throws java.io.IOException
        Reads the a single posting (not an iterable posting - use BitPostingIndex for that)
        Specified by:
        readFields in interface org.apache.hadoop.io.Writable
        Throws:
        java.io.IOException
      • write

        public void write​(java.io.DataOutput out)
                   throws java.io.IOException
        Writes the current posting (not an iterable posting - use DirectInvertedOutputStream for that). Compression using this method is not expected to be comparable to bit-level compression.
        Specified by:
        write in interface org.apache.hadoop.io.Writable
        Throws:
        java.io.IOException
      • setId

        public void setId​(int _id)
        Set the id of this posting
        Specified by:
        setId in interface Posting
        Specified by:
        setId in interface WritablePosting
      • getDocumentLength

        public int getDocumentLength()
        Returns 0
        Specified by:
        getDocumentLength in interface Posting
        Returns:
        length of the document of the current posting in tokens.
      • asWritablePosting

        public WritablePosting asWritablePosting()
        Copy this posting to one free of an iterator. Kind of like a clone.
        Specified by:
        asWritablePosting in interface Posting
        Returns:
        an identical posting, but which can be manipulated free of this iterator
      • toString

        public java.lang.String toString()
        Makes a human readable form of this posting
        Overrides:
        toString in class java.lang.Object
      • setDocumentLength

        public void setDocumentLength​(int l)
        Description copied from interface: WritablePosting
        Set the length of the document of the current posting in tokens.
        Specified by:
        setDocumentLength in interface WritablePosting
        Parameters:
        l - length of the document of the current posting in tokens.
      • setTf

        public void setTf​(int tf)
        Set the term frequency in the document
        Parameters:
        tf -