Class MemoryDocumentIndex

    • Field Detail

      • docLengths

        public gnu.trove.TIntArrayList docLengths
    • Constructor Detail

      • MemoryDocumentIndex

        public MemoryDocumentIndex()
        Constructor.
    • Method Detail

      • addDocument

        public void addDocument​(int length)
        Add document length to document index.
      • setLength

        public void setLength​(int docid,
                              int newLength)
      • getDocumentEntry

        public DocumentIndexEntry getDocumentEntry​(int docid)
                                            throws java.io.IOException
        Return the document index entry based on its docid.
        Specified by:
        getDocumentEntry in interface DocumentIndex
        Returns:
        the document index entry based on its docid.
        Throws:
        java.io.IOException
      • getDocumentLength

        public int getDocumentLength​(int docid)
                              throws java.io.IOException
        Return the length of the document.
        Specified by:
        getDocumentLength in interface DocumentIndex
        Returns:
        the length of the document.
        Throws:
        java.io.IOException
      • getNumberOfDocuments

        public int getNumberOfDocuments()
        Return the number of documents.
        Specified by:
        getNumberOfDocuments in interface DocumentIndex
        Returns:
        the number of documents.
      • iteratorOverEntries

        public java.util.Iterator<java.util.Map.Entry<java.lang.Integer,​DocumentIndexEntry>> iteratorOverEntries()
        Return an iterator over the document index. iterates over Map.Entry, where the key is the integer docid - only used my the Memory index, not the index-on-disk.
      • iterator

        public java.util.Iterator<DocumentIndexEntry> iterator()
        Return an iterator over the document index.