Class AbstractIndex<C>

java.lang.Object
es.uam.eps.ir.relison.content.index.AbstractIndex<C>
All Implemented Interfaces:
DocumentMap<C>, Index<C>
Direct Known Subclasses:
AbstractIndividualContentIndex, LuceneIndex

public abstract class AbstractIndex<C>
extends java.lang.Object
implements Index<C>
Abstract implementation of an index.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected it.unimi.dsi.fastutil.objects.Object2IntMap<C> backward
    Mapping from contents to identifiers.
    protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<C> forward
    Mapping from identifiers to contents.
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractIndex()  
  • Method Summary

    Modifier and Type Method Description
    C getContent​(int docID)
    Obtains the user corresponding to an identifier.
    int getContentId​(C path)
    Obtains the identifier of a content in the index.
    void loadContents​(java.lang.String indexFolder, org.ranksys.formats.parsing.Parser<C> cParser)
    Loads the users.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface es.uam.eps.ir.relison.content.index.DocumentMap

    numDocs

    Methods inherited from interface es.uam.eps.ir.relison.content.index.Index

    getAllTerms, getDocFreq, getPostings, getTotalFreq
  • Field Details

    • forward

      protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<C> forward
      Mapping from identifiers to contents.
    • backward

      protected it.unimi.dsi.fastutil.objects.Object2IntMap<C> backward
      Mapping from contents to identifiers.
  • Constructor Details

  • Method Details

    • getContent

      public C getContent​(int docID)
      Description copied from interface: DocumentMap
      Obtains the user corresponding to an identifier.
      Specified by:
      getContent in interface DocumentMap<C>
      Parameters:
      docID - document identifier.
      Returns:
      the content corresponding to such identifier.
    • getContentId

      public int getContentId​(C path)
      Description copied from interface: DocumentMap
      Obtains the identifier of a content in the index.
      Specified by:
      getContentId in interface DocumentMap<C>
      Parameters:
      path - the content to look up.
      Returns:
      the identifier of the content.
    • loadContents

      public void loadContents​(java.lang.String indexFolder, org.ranksys.formats.parsing.Parser<C> cParser) throws java.io.IOException
      Loads the users.
      Parameters:
      indexFolder - folder in which the index is stored.
      cParser - user parser.
      Throws:
      java.io.IOException - if something fails while reading the users.