Class AbstractIndividualContentIndex<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>
- Type Parameters:
C
- type of the contents.U
- type of the users.
- All Implemented Interfaces:
DocumentMap<C>
,Index<C>
,IndividualContentIndex<C,U>
- Direct Known Subclasses:
WrapperIndividualContentIndex
,WrapperIndividualForwardContentIndex
public abstract class AbstractIndividualContentIndex<C,U> extends AbstractIndex<C> implements IndividualContentIndex<C,U>
Abstract implementation of a content index.
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<U>
contentsToUsers
Mapping from identifiers to usersprotected it.unimi.dsi.fastutil.objects.Object2ObjectMap<U,it.unimi.dsi.fastutil.ints.IntList>
usersToContents
Mapping from the users to the identifiers of the user generated contents. -
Constructor Summary
Constructors Constructor Description AbstractIndividualContentIndex()
-
Method Summary
Modifier and Type Method Description java.util.List<java.lang.Integer>
getContents(U user)
Given a user identifier, obtains the list of contents published by the user.U
getUser(int docID)
Given a content identifier, obtains the user that created it.protected void
loadUserContentMap(java.lang.String indexPath, org.ranksys.formats.parsing.Parser<U> uParser)
Loads a file containing the relation between indexes and user identifiers.Methods inherited from class es.uam.eps.ir.relison.content.index.AbstractIndex
getContent, getContentId, loadContents
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
getContent, getContentId, numDocs
Methods inherited from interface es.uam.eps.ir.relison.content.index.Index
getAllTerms, getDocFreq, getPostings, getTotalFreq
-
Field Details
-
contentsToUsers
Mapping from identifiers to users -
usersToContents
protected it.unimi.dsi.fastutil.objects.Object2ObjectMap<U,it.unimi.dsi.fastutil.ints.IntList> usersToContentsMapping from the users to the identifiers of the user generated contents.
-
-
Constructor Details
-
AbstractIndividualContentIndex
public AbstractIndividualContentIndex()
-
-
Method Details
-
getUser
Description copied from interface:IndividualContentIndex
Given a content identifier, obtains the user that created it.- Specified by:
getUser
in interfaceIndividualContentIndex<C,U>
- Parameters:
docID
- the content identifier.- Returns:
- the creator of the content.
-
getContents
Description copied from interface:IndividualContentIndex
Given a user identifier, obtains the list of contents published by the user.- Specified by:
getContents
in interfaceIndividualContentIndex<C,U>
- Parameters:
user
- the user identifier- Returns:
- the list of identifiers of the contents in the index.
-
loadUserContentMap
protected void loadUserContentMap(java.lang.String indexPath, org.ranksys.formats.parsing.Parser<U> uParser) throws java.io.IOExceptionLoads a file containing the relation between indexes and user identifiers.- Parameters:
indexPath
- the path of the index.uParser
- parser for reading the users.- Throws:
java.io.IOException
- if something fails while writing the map.
-