Class MemoryInvertedIndex

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Serializable, java.lang.AutoCloseable, PostingIndex<MemoryPointer>
    Direct Known Subclasses:
    MemoryFieldsInvertedIndex

    public class MemoryInvertedIndex
    extends java.lang.Object
    implements PostingIndex<MemoryPointer>, java.io.Serializable
    A basic inverted file implementation for use with MemoryIndex structures. This version does not support fields or blocks. Since it is a memory-based structure, access is via a MemoryPointer rather than BitIndexPointer.
    Since:
    4.0
    Author:
    Richard McCreadie, Stuart Mackie
    See Also:
    Serialized Form
    • Constructor Detail

      • MemoryInvertedIndex

        public MemoryInvertedIndex​(Lexicon<java.lang.String> lex,
                                   DocumentIndex doi)
        Constructor.
    • Method Detail

      • add

        public void add​(int ptr,
                        int docid,
                        int freq)
        Add posting to inverted file.
      • addOrUpdate

        public boolean addOrUpdate​(int ptr,
                                   int docid,
                                   int freq)
        Adds or updates the frequency of the term denoted by ptr by freq.
        Returns:
        true if a new posting was created, false if the document already contained the term
      • remove

        public void remove​(int ptr)
        Remove a term posting list from the index, e.g. remove a stopword
        Parameters:
        ptr -
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException