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 Summary
Fields Modifier and Type Field Description private ForwardIndex<C>indexThe internal index.Fields inherited from class es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex
contentsToUsers, usersToContents -
Constructor Summary
Constructors Constructor Description WrapperIndividualForwardContentIndex(ForwardIndex<C> index, it.unimi.dsi.fastutil.ints.Int2ObjectMap<U> userMap)Constructor.WrapperIndividualForwardContentIndex(java.lang.String indexFolder, ForwardIndex<C> index, org.ranksys.formats.parsing.Parser<U> uParser)Constructor. -
Method Summary
Modifier and Type Method Description java.util.Collection<java.lang.String>getAllTerms()Obtains the set of all terms in the index dictionary.FreqVectorgetContentVector(int contentId)Obtains a user vector.longgetDocFreq(java.lang.String term)Obtains the number of documents containing the term.PostingsListgetPostings(java.lang.String term)Obtains the posting list of a term.longgetTermFreq(java.lang.String term, int contentId)Obtains the term frequency of a term in a user vector.longgetTotalFreq(java.lang.String term)Obtains the total frequency of a term in the collection.intnumDocs()Obtains the number of contents.Methods inherited from class es.uam.eps.ir.relison.content.index.individual.AbstractIndividualContentIndex
getContents, getUser, loadUserContentMapMethods inherited from class es.uam.eps.ir.relison.content.index.AbstractIndex
getContent, getContentId, loadContentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface es.uam.eps.ir.relison.content.index.DocumentMap
getContent, getContentId
-
Field Details
-
index
The internal index.
-
-
Constructor Details
-
WrapperIndividualForwardContentIndex
public WrapperIndividualForwardContentIndex(java.lang.String indexFolder, ForwardIndex<C> index, org.ranksys.formats.parsing.Parser<U> uParser) throws java.io.IOExceptionConstructor.- 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
Description copied from interface:IndexObtains the posting list of a term.- Specified by:
getPostingsin interfaceIndex<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.IOExceptionDescription copied from interface:IndexObtains the set of all terms in the index dictionary.- Specified by:
getAllTermsin interfaceIndex<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.IOExceptionDescription copied from interface:IndexObtains the total frequency of a term in the collection.- Specified by:
getTotalFreqin interfaceIndex<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.IOExceptionDescription copied from interface:IndexObtains the number of documents containing the term.- Specified by:
getDocFreqin interfaceIndex<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:DocumentMapObtains the number of contents.- Specified by:
numDocsin interfaceDocumentMap<C>- Returns:
- the number of contents.
-
getContentVector
Description copied from interface:ForwardIndexObtains a user vector.- Specified by:
getContentVectorin interfaceForwardIndex<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.IOExceptionDescription copied from interface:ForwardIndexObtains the term frequency of a term in a user vector.- Specified by:
getTermFreqin interfaceForwardIndex<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.
-