Class WrapperIndividualForwardContentIndex<C,​U>

java.lang.Object
es.uam.eps.ir.relison.content.index.AbstractIndex<C>
es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex<C,​U>
es.uam.eps.ir.relison.content.index.individual.WrapperIndividualForwardContentIndex<C,​U>
Type Parameters:
C - type of the contents.
U - type of the users.
All Implemented Interfaces:
DocumentMap<C>, ForwardIndex<C>, Index<C>, IndividualContentIndex<C,​U>

public class WrapperIndividualForwardContentIndex<C,​U>
extends AbstractIndividualContentIndex<C,​U>
implements ForwardIndex<C>
Individual content index builder wrapping a simple one.
  • Field Details

  • Constructor Details

    • WrapperIndividualForwardContentIndex

      public WrapperIndividualForwardContentIndex​(java.lang.String indexFolder, ForwardIndex<C> index, org.ranksys.formats.parsing.Parser<U> uParser) throws java.io.IOException
      Constructor.
      Parameters:
      indexFolder - route to the index.
      index - the index.
      uParser - a user parser.
      Throws:
      java.io.IOException - if something fails while loading the content to user map.
    • WrapperIndividualForwardContentIndex

      public WrapperIndividualForwardContentIndex​(ForwardIndex<C> index, it.unimi.dsi.fastutil.ints.Int2ObjectMap<U> userMap)
      Constructor.
      Parameters:
      index - the index.
      userMap - the content to user map.
  • Method Details

    • getPostings

      public PostingsList getPostings​(java.lang.String term) throws java.io.IOException
      Description copied from interface: Index
      Obtains the posting list of a term.
      Specified by:
      getPostings in interface Index<C>
      Parameters:
      term - the term to look up.
      Returns:
      the posting list of the term.
      Throws:
      java.io.IOException - if something fails while reading the posting list.
    • getAllTerms

      public java.util.Collection<java.lang.String> getAllTerms() throws java.io.IOException
      Description copied from interface: Index
      Obtains the set of all terms in the index dictionary.
      Specified by:
      getAllTerms in interface Index<C>
      Returns:
      the collection of terms.
      Throws:
      java.io.IOException - if something fails while reading the list of terms.
    • getTotalFreq

      public long getTotalFreq​(java.lang.String term) throws java.io.IOException
      Description copied from interface: Index
      Obtains the total frequency of a term in the collection.
      Specified by:
      getTotalFreq in interface Index<C>
      Parameters:
      term - the term to look up.
      Returns:
      the total frequency of the term in the collection.
      Throws:
      java.io.IOException - if something fails while reading the frequency.
    • getDocFreq

      public long getDocFreq​(java.lang.String term) throws java.io.IOException
      Description copied from interface: Index
      Obtains the number of documents containing the term.
      Specified by:
      getDocFreq in interface Index<C>
      Parameters:
      term - the term to look up.
      Returns:
      the number of documents containing the term.
      Throws:
      java.io.IOException - if something fails while reading the doc frequency.
    • numDocs

      public int numDocs()
      Description copied from interface: DocumentMap
      Obtains the number of contents.
      Specified by:
      numDocs in interface DocumentMap<C>
      Returns:
      the number of contents.
    • getContentVector

      public FreqVector getContentVector​(int contentId) throws java.io.IOException
      Description copied from interface: ForwardIndex
      Obtains a user vector.
      Specified by:
      getContentVector in interface ForwardIndex<C>
      Parameters:
      contentId - identifier of the content in the index.
      Returns:
      a frequency vector for the corresponding content.
      Throws:
      java.io.IOException - if something fails while reading the index.
    • getTermFreq

      public long getTermFreq​(java.lang.String term, int contentId) throws java.io.IOException
      Description copied from interface: ForwardIndex
      Obtains the term frequency of a term in a user vector.
      Specified by:
      getTermFreq in interface ForwardIndex<C>
      Parameters:
      term - the term to look up.
      contentId - the content identifier
      Returns:
      the frequency of the term in the content vector
      Throws:
      java.io.IOException - if something fails while reading the value.