public class QueryResultSet extends CollectionResultSet
Modifier and Type | Field and Description |
---|---|
protected String[][] |
metadata
The structure holding the metadata.
|
protected gnu.trove.TObjectIntHashMap<String> |
metaMap
The structure that holds the metadata about the results.
|
arraysInitialised, docids, exactResultSize, lock, occurrences, resultSize, scores, statusCode
Constructor and Description |
---|
QueryResultSet(int numberOfDocuments)
A default constructor for the result set with a given
number of documents.
|
QueryResultSet(int[] docids,
double[] ds,
short[] occurrences) |
Modifier and Type | Method and Description |
---|---|
void |
addMetaItem(String name,
int index,
String value)
Adds a metadata value for a given document
|
void |
addMetaItems(String name,
String[] values)
Adds the metadata values for all the documents in the result set.
|
protected int |
addMetaType(String name)
Get the metadata index for the given name
|
String[][] |
allMetaItems()
returns all metadata, indexed first by metadata type, then by rank.
|
String |
getMetaItem(String name,
int index)
Gets a metadata value for a given document.
|
String[] |
getMetaItems(String name)
Gets the metadata information for all documents.
|
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(String name)
does the metaindex have a particular type of metadata?
|
void |
initialise()
Initialises the arrays prior of retrieval.
|
protected QueryResultSet |
makeNewResultSet(int length) |
void |
sort()
Sorts all documents in this resultset by descending score
|
void |
sort(int topDocs)
Sorts the top topDocs document in this resultset be first.
|
getDocids, getExactResultSize, getLock, getOccurrences, getResultSize, getScores, getStatusCode, initialise, setExactResultSize, setResultSize, setStatusCode
protected gnu.trove.TObjectIntHashMap<String> metaMap
protected String[][] metadata
public QueryResultSet(int numberOfDocuments)
numberOfDocuments
- the number of documents contained in the result set.public QueryResultSet(int[] docids, double[] ds, short[] occurrences)
public void initialise()
initialise
in interface ResultSet
initialise
in class CollectionResultSet
public void addMetaItem(String name, int index, String value)
addMetaItem
in interface ResultSet
addMetaItem
in class CollectionResultSet
name
- 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(String name, String[] values)
addMetaItems
in interface ResultSet
addMetaItems
in class CollectionResultSet
name
- the name of the metadata type. For example, it can be url for adding the URLs of documents.values
- the metadata values.public String getMetaItem(String name, int index)
getMetaItem
in interface ResultSet
getMetaItem
in class CollectionResultSet
name
- the name of the metadata type.index
- the postition in the arraypublic String[] getMetaItems(String name)
getMetaItems
in interface ResultSet
getMetaItems
in class CollectionResultSet
name
- the name of the metadata type.public String[][] allMetaItems()
allMetaItems
in interface ResultSet
allMetaItems
in class CollectionResultSet
public boolean hasMetaItems(String name)
hasMetaItems
in interface ResultSet
hasMetaItems
in class CollectionResultSet
name
- of the desired metaitem setpublic String[] getMetaKeys()
getMetaKeys
in interface ResultSet
getMetaKeys
in class CollectionResultSet
protected int addMetaType(String name)
name
- The name of the metadata type to add onprotected QueryResultSet makeNewResultSet(int length)
public ResultSet getResultSet(int startPosition, int length)
getResultSet
in interface ResultSet
getResultSet
in class CollectionResultSet
startPosition
- the beginning of the subset.length
- the number of entries to get.public ResultSet getResultSet(int[] positions)
getResultSet
in interface ResultSet
getResultSet
in class CollectionResultSet
positions
- int[] the list of elements in the current
list that should be kept.public void sort()
ResultSet
sort
in interface ResultSet
sort
in class CollectionResultSet
public void sort(int topDocs)
ResultSet
sort
in interface ResultSet
sort
in class CollectionResultSet
topDocs
- number of documents to top-rankTerrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow