|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terrier.matching.CollectionResultSet
org.terrier.matching.QueryResultSet
public class QueryResultSet
A result set for a given query. This result set is created for
a given number of documents, usually the number of retrieved
documents for a query. Initially, it is created by cropping
an instance of the CollectionResultSet, that is used in the
Matching classes.
This class has support for adding metadata as well.
| Field Summary | |
|---|---|
protected java.lang.String[][] |
metadata
The structure holding the metadata. |
protected gnu.trove.TObjectIntHashMap<java.lang.String> |
metaMap
The structure that holds the metadata about the results. |
| Fields inherited from class org.terrier.matching.CollectionResultSet |
|---|
arraysInitialised, docids, exactResultSize, lock, occurrences, resultSize, scores, statusCode |
| Constructor Summary | |
|---|---|
QueryResultSet(int numberOfDocuments)
A default constructor for the result set with a given number of documents. |
|
QueryResultSet(int[] docids,
double[] ds,
short[] occurrences)
|
|
| Method Summary | |
|---|---|
void |
addMetaItem(java.lang.String name,
int index,
java.lang.String value)
Adds a metadata value for a given document |
void |
addMetaItems(java.lang.String name,
java.lang.String[] values)
Adds the metadata values for all the documents in the result set. |
protected int |
addMetaType(java.lang.String name)
Get the metadata index for the given name |
java.lang.String |
getMetaItem(java.lang.String name,
int index)
Gets a metadata value for a given document. |
java.lang.String[] |
getMetaItems(java.lang.String name)
Gets the metadata information for all documents. |
java.lang.String[] |
getMetaKeys()
Returns the names of the meta keys which this resultset has |
ResultSet |
getResultSet(int[] positions)
Extracts a subset of the resultset given by the list parameter, which contains a list of positions in the resultset that should be saved. |
ResultSet |
getResultSet(int startPosition,
int length)
Crops the existing result file and extracts a subset from the given starting point to the ending point. |
boolean |
hasMetaItems(java.lang.String name)
Returns true if the resultset already has a set of metaitems with the specified name. |
void |
initialise()
Initialises the arrays prior of retrieval. |
protected QueryResultSet |
makeNewResultSet(int length)
|
| 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 |
| Field Detail |
|---|
protected gnu.trove.TObjectIntHashMap<java.lang.String> metaMap
protected java.lang.String[][] metadata
| Constructor Detail |
|---|
public QueryResultSet(int numberOfDocuments)
numberOfDocuments - the number of documents contained in the result set.
public QueryResultSet(int[] docids,
double[] ds,
short[] occurrences)
| Method Detail |
|---|
public void initialise()
initialise in interface ResultSetinitialise in class CollectionResultSet
public void addMetaItem(java.lang.String name,
int index,
java.lang.String value)
addMetaItem in interface ResultSetaddMetaItem in class CollectionResultSetname - the name of the metadata type. For example, it can be url for adding the URLs of documents.index - the position in the resultset array of the given documentvalue - the metadata value.
public void addMetaItems(java.lang.String name,
java.lang.String[] values)
addMetaItems in interface ResultSetaddMetaItems in class CollectionResultSetname - the name of the metadata type. For example, it can be url for adding the URLs of documents.values - the metadata values.
public java.lang.String getMetaItem(java.lang.String name,
int index)
getMetaItem in interface ResultSetgetMetaItem in class CollectionResultSetname - the name of the metadata type.index - the postition in the array
public java.lang.String[] getMetaItems(java.lang.String name)
getMetaItems in interface ResultSetgetMetaItems in class CollectionResultSetname - the name of the metadata type.
public boolean hasMetaItems(java.lang.String name)
CollectionResultSet
hasMetaItems in interface ResultSethasMetaItems in class CollectionResultSetname - of the desired metaitem set
public java.lang.String[] getMetaKeys()
getMetaKeys in interface ResultSetgetMetaKeys in class CollectionResultSetprotected int addMetaType(java.lang.String name)
name - The name of the metadata type to add on
protected QueryResultSet makeNewResultSet(int length)
public ResultSet getResultSet(int startPosition,
int length)
getResultSet in interface ResultSetgetResultSet in class CollectionResultSetstartPosition - the beginning of the subset.length - the number of entries to get.
public ResultSet getResultSet(int[] positions)
getResultSet in interface ResultSetgetResultSet in class CollectionResultSetpositions - int[] the list of elements in the current
list that should be kept.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||