public class CollectionResultSet extends Object implements ResultSet, Serializable
Modifier and Type | Field and Description |
---|---|
protected boolean |
arraysInitialised
A static boolean flag indicating whether the arrays of docids and scores
have been initialized (memory allocated for them) or not.
|
protected int[] |
docids
The array that stores the document ids.
|
protected int |
exactResultSize
The number of retrieved documents.
|
protected Lock |
lock
A lock for enabling access of the result set by different threads
|
protected short[] |
occurrences
The occurrences of the query terms in a document.
|
protected int |
resultSize
The number of documents that have been ranked and
sorted according to their scores.
|
protected double[] |
scores
An array holding the scores of documents in the collection.
|
protected int |
statusCode
A status code for the result set.
|
Constructor and Description |
---|
CollectionResultSet(int numberOfDocuments)
A default constructor for the result set with a given
number of documents.
|
CollectionResultSet(int[] _docids,
double[] _scores,
short[] _occurrences)
Construct a resultset from the following components
|
CollectionResultSet(ResultSet resultSet)
A default constructor for the result set with a given
instance of the result set.
|
Modifier and Type | Method and Description |
---|---|
void |
addMetaItem(String name,
int docid,
String value)
Empty method.
|
void |
addMetaItems(String name,
String[] values)
Empty method.
|
int[] |
getDocids()
Returns the documents ids after retrieval
|
int |
getExactResultSize()
Returns the exact size of the result set.
|
Lock |
getLock()
Returns the lock for enabling the modification of the result set by
more than one threads.
|
String |
getMetaItem(String name,
int docid)
Empty method.
|
String[] |
getMetaItems(String name)
Empty method.
|
String[] |
getMetaKeys()
Returns the names of the meta keys which this resultset has
|
short[] |
getOccurrences()
Returns the occurrences array.
|
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 start,
int length)
Crops the existing result file and extracts a subset
from the given starting point to the ending point.
|
int |
getResultSize()
Returns the effective size of the result set.
|
double[] |
getScores()
Returns the documents scores after retrieval
|
int |
getStatusCode()
Returns the status code for the current result set.
|
boolean |
hasMetaItems(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.
|
void |
initialise(double[] scs)
Initialises the result set with the given scores.
|
void |
setExactResultSize(int newExactResultSize)
Sets the exact size of the result set, that is the
number of documents that would be retrieved, if the result
set was not truncated.
|
void |
setResultSize(int newResultSize)
Sets the effective size of the result set, that is the number of documents
to be sorted after retrieval.
|
void |
setStatusCode(int _statusCode)
Sets the status code for the current result set.
|
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.
|
protected int[] docids
protected double[] scores
protected short[] occurrences
protected boolean arraysInitialised
protected int resultSize
protected int exactResultSize
protected Lock lock
protected int statusCode
public CollectionResultSet(int[] _docids, double[] _scores, short[] _occurrences)
public CollectionResultSet(int numberOfDocuments)
numberOfDocuments
- the number of documents contained in the result set.public CollectionResultSet(ResultSet resultSet)
resultSet
- The given result set.public Lock getLock()
public int getStatusCode()
getStatusCode
in interface ResultSet
public void setStatusCode(int _statusCode)
setStatusCode
in interface ResultSet
_statusCode
- - the code to return to the userpublic int[] getDocids()
public int getResultSize()
getResultSize
in interface ResultSet
public short[] getOccurrences()
getOccurrences
in interface ResultSet
public int getExactResultSize()
getExactResultSize
in interface ResultSet
public double[] getScores()
public void initialise()
initialise
in interface ResultSet
public void initialise(double[] scs)
initialise
in interface ResultSet
scs
- double[] the scores to initiliase the result set with.public void setResultSize(int newResultSize)
setResultSize
in interface ResultSet
newResultSize
- int the effective size of the result set.public void setExactResultSize(int newExactResultSize)
setExactResultSize
in interface ResultSet
newExactResultSize
- int the effective size of the result set.public void addMetaItem(String name, int docid, String value)
addMetaItem
in interface ResultSet
name
- the name of the metadata type. For example, it can be
the url for adding the URLs of documents.docid
- the document identifier of the document.value
- the metadata value.public void addMetaItems(String name, String[] values)
addMetaItems
in interface ResultSet
name
- the name of the metadata type. For example, it can
be the url for adding the URLs of documents.values
- the metadata values.public String getMetaItem(String name, int docid)
getMetaItem
in interface ResultSet
name
- the name of the metadata type.docid
- the document identifier of the document.public String[] getMetaItems(String name)
getMetaItems
in interface ResultSet
name
- the name of the metadata type.public ResultSet getResultSet(int start, int length)
getResultSet
in interface ResultSet
start
- the beginning of the subset.length
- the end of the subset.public ResultSet getResultSet(int[] positions)
getResultSet
in interface ResultSet
positions
- int[] the list of elements in the current list
that should be kept.public boolean hasMetaItems(String name)
hasMetaItems
in interface ResultSet
name
- of the desired metaitem setpublic String[] getMetaKeys()
getMetaKeys
in interface ResultSet
public void sort()
ResultSet
Terrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow