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 CollectionStatisticsgetCollectionStatistics()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.FatResultSetgetResultSet(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 queryvoidreadFields(java.io.DataInput in)voidsetCollectionStatistics(CollectionStatistics cs)voidsetDocids(int[] ds)voidsetEntryStatistics(EntryStatistics[] es)voidsetKeyFrequencies(double[] ks)voidsetOccurrences(short[] os)voidsetPostings(WritablePosting[][] wp)voidsetQueryTerms(java.lang.String[] qs)voidsetScores(double[] ss)voidsetTags(java.util.Set<java.lang.String>[] ks)voidsort(int topDocs)Sorts the top topDocs document in this resultset be first.voidwrite(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:
getPostingsin interfaceFatResultSet- Returns:
- 2D array of postings.
-
getKeyFrequencies
public double[] getKeyFrequencies()
Return the frequencies of each of the query terms in the query- Specified by:
getKeyFrequenciesin interfaceFatResultSet
-
getEntryStatistics
public EntryStatistics[] getEntryStatistics()
Return the EntryStatistics of each of the query terms in the query- Specified by:
getEntryStatisticsin interfaceFatResultSet
-
getCollectionStatistics
public CollectionStatistics getCollectionStatistics()
Get the collection statistics that should be applied when (re)scoring any documents in this query- Specified by:
getCollectionStatisticsin interfaceFatResultSet
-
getQueryTerms
public java.lang.String[] getQueryTerms()
Get the query terms in this query. This might be encoded in PostingListManager form- Specified by:
getQueryTermsin interfaceFatResultSet
-
readFields
public void readFields(java.io.DataInput in) throws java.io.IOException- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
java.io.IOException
-
write
public void write(java.io.DataOutput out) throws java.io.IOException- Specified by:
writein 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:
getResultSetin interfaceResultSet- Overrides:
getResultSetin 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:
sortin interfaceResultSet- Overrides:
sortin classQueryResultSet- Parameters:
topDocs- number of documents to top-rank
-
setPostings
public void setPostings(WritablePosting[][] wp)
- Specified by:
setPostingsin interfaceFatResultSet
-
setKeyFrequencies
public void setKeyFrequencies(double[] ks)
- Specified by:
setKeyFrequenciesin interfaceFatResultSet
-
setEntryStatistics
public void setEntryStatistics(EntryStatistics[] es)
- Specified by:
setEntryStatisticsin interfaceFatResultSet
-
setCollectionStatistics
public void setCollectionStatistics(CollectionStatistics cs)
- Specified by:
setCollectionStatisticsin interfaceFatResultSet
-
setQueryTerms
public void setQueryTerms(java.lang.String[] qs)
- Specified by:
setQueryTermsin interfaceFatResultSet
-
setDocids
public void setDocids(int[] ds)
- Specified by:
setDocidsin interfaceFatResultSet
-
setOccurrences
public void setOccurrences(short[] os)
- Specified by:
setOccurrencesin interfaceFatResultSet
-
setScores
public void setScores(double[] ss)
- Specified by:
setScoresin interfaceFatResultSet
-
getTags
public java.util.Set<java.lang.String>[] getTags()
Description copied from interface:FatResultSetReturn the tags of each of the query terms in the query- Specified by:
getTagsin interfaceFatResultSet
-
setTags
public void setTags(java.util.Set<java.lang.String>[] ks)
- Specified by:
setTagsin interfaceFatResultSet
-
-