Package org.terrier.matching
Class FatQueryResultSet
- java.lang.Object
-
- org.terrier.matching.CollectionResultSet
-
- org.terrier.matching.QueryResultSet
-
- org.terrier.matching.FatQueryResultSet
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.hadoop.io.Writable
,FatResultSet
,ResultSet
public class FatQueryResultSet extends QueryResultSet implements FatResultSet
An implementation ofFatResultSet
.- Since:
- 4.0
- Author:
- Craig Macdonald
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.terrier.matching.QueryResultSet
metadata, metaMap
-
Fields inherited from class org.terrier.matching.CollectionResultSet
arraysInitialised, docids, exactResultSize, lock, occurrences, resultSize, scores, statusCode
-
-
Constructor Summary
Constructors Constructor Description FatQueryResultSet(int numberOfDocuments, CollectionStatistics cs, java.lang.String[] qs, EntryStatistics[] es, double[] ks, java.util.Set<java.lang.String>[] ts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollectionStatistics
getCollectionStatistics()
Get the collection statistics that should be applied when (re)scoring any documents in this queryEntryStatistics[]
getEntryStatistics()
Return the EntryStatistics of each of the query terms in the querydouble[]
getKeyFrequencies()
Return the frequencies of each of the query terms in the queryWritablePosting[][]
getPostings()
Returns a 2D array of posting objects for the document and terms in this result set.java.lang.String[]
getQueryTerms()
Get the query terms in this query.FatResultSet
getResultSet(int start, int length)
Crops the existing result file and extracts a subset from the given starting point to the ending point.java.util.Set<java.lang.String>[]
getTags()
Return the tags of each of the query terms in the queryvoid
readFields(java.io.DataInput in)
void
setCollectionStatistics(CollectionStatistics cs)
void
setDocids(int[] ds)
void
setEntryStatistics(EntryStatistics[] es)
void
setKeyFrequencies(double[] ks)
void
setOccurrences(short[] os)
void
setPostings(WritablePosting[][] wp)
void
setQueryTerms(java.lang.String[] qs)
void
setScores(double[] ss)
void
setTags(java.util.Set<java.lang.String>[] ks)
void
sort(int topDocs)
Sorts the top topDocs document in this resultset be first.void
write(java.io.DataOutput out)
-
Methods inherited from class org.terrier.matching.QueryResultSet
addMetaItem, addMetaItems, addMetaType, allMetaItems, getMetaItem, getMetaItems, getMetaKeys, getResultSet, hasMetaItems, initialise, makeNewResultSet, sort
-
Methods inherited from class org.terrier.matching.CollectionResultSet
getDocids, getExactResultSize, getLock, getOccurrences, getResultSize, getScores, getStatusCode, initialise, setExactResultSize, setResultSize, setStatusCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.terrier.matching.ResultSet
addMetaItem, addMetaItems, allMetaItems, getDocids, getExactResultSize, getLock, getMetaItem, getMetaItems, getMetaKeys, getOccurrences, getResultSet, getResultSize, getScores, getStatusCode, hasMetaItems, initialise, initialise, setExactResultSize, setResultSize, setStatusCode, sort
-
-
-
-
Constructor Detail
-
FatQueryResultSet
public FatQueryResultSet(int numberOfDocuments, CollectionStatistics cs, java.lang.String[] qs, EntryStatistics[] es, double[] ks, java.util.Set<java.lang.String>[] ts)
-
-
Method Detail
-
getPostings
public WritablePosting[][] getPostings()
Returns a 2D array of posting objects for the document and terms in this result set. The array is indexed by document then by term. The first dimension retains the same order as the Docids array of the result set. The second dimension has the same ordering as the QueryTerms/EntryStatistics arrays.- Specified by:
getPostings
in interfaceFatResultSet
- Returns:
- 2D array of postings.
-
getKeyFrequencies
public double[] getKeyFrequencies()
Return the frequencies of each of the query terms in the query- Specified by:
getKeyFrequencies
in interfaceFatResultSet
-
getEntryStatistics
public EntryStatistics[] getEntryStatistics()
Return the EntryStatistics of each of the query terms in the query- Specified by:
getEntryStatistics
in interfaceFatResultSet
-
getCollectionStatistics
public CollectionStatistics getCollectionStatistics()
Get the collection statistics that should be applied when (re)scoring any documents in this query- Specified by:
getCollectionStatistics
in interfaceFatResultSet
-
getQueryTerms
public java.lang.String[] getQueryTerms()
Get the query terms in this query. This might be encoded in PostingListManager form- Specified by:
getQueryTerms
in interfaceFatResultSet
-
readFields
public void readFields(java.io.DataInput in) throws java.io.IOException
- Specified by:
readFields
in interfaceorg.apache.hadoop.io.Writable
- Throws:
java.io.IOException
-
write
public void write(java.io.DataOutput out) throws java.io.IOException
- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Throws:
java.io.IOException
-
getResultSet
public FatResultSet getResultSet(int start, int length)
Crops the existing result file and extracts a subset from the given starting point to the ending point.- Specified by:
getResultSet
in interfaceResultSet
- Overrides:
getResultSet
in classQueryResultSet
- Parameters:
start
- the beginning of the subset.length
- the number of entries to get.- Returns:
- a subset of the current result set.
-
sort
public void sort(int topDocs)
Sorts the top topDocs document in this resultset be first. The order of the remaining documents is undefined.- Specified by:
sort
in interfaceResultSet
- Overrides:
sort
in classQueryResultSet
- Parameters:
topDocs
- number of documents to top-rank
-
setPostings
public void setPostings(WritablePosting[][] wp)
- Specified by:
setPostings
in interfaceFatResultSet
-
setKeyFrequencies
public void setKeyFrequencies(double[] ks)
- Specified by:
setKeyFrequencies
in interfaceFatResultSet
-
setEntryStatistics
public void setEntryStatistics(EntryStatistics[] es)
- Specified by:
setEntryStatistics
in interfaceFatResultSet
-
setCollectionStatistics
public void setCollectionStatistics(CollectionStatistics cs)
- Specified by:
setCollectionStatistics
in interfaceFatResultSet
-
setQueryTerms
public void setQueryTerms(java.lang.String[] qs)
- Specified by:
setQueryTerms
in interfaceFatResultSet
-
setDocids
public void setDocids(int[] ds)
- Specified by:
setDocids
in interfaceFatResultSet
-
setOccurrences
public void setOccurrences(short[] os)
- Specified by:
setOccurrences
in interfaceFatResultSet
-
setScores
public void setScores(double[] ss)
- Specified by:
setScores
in interfaceFatResultSet
-
getTags
public java.util.Set<java.lang.String>[] getTags()
Description copied from interface:FatResultSet
Return the tags of each of the query terms in the query- Specified by:
getTags
in interfaceFatResultSet
-
setTags
public void setTags(java.util.Set<java.lang.String>[] ks)
- Specified by:
setTags
in interfaceFatResultSet
-
-