public class CandidateResultSet extends Object implements ResultSet, Serializable
CandidateResult
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int[] |
docids |
protected int |
exactResultSize |
protected Lock |
lock |
protected short[] |
occurrences |
protected int |
resultSize |
protected double[] |
scores |
protected int |
statusCode |
Modifier | Constructor and Description |
---|---|
protected |
CandidateResultSet() |
|
CandidateResultSet(List<CandidateResult> q)
Create a ResultSet from the specified list of results
|
|
CandidateResultSet(Queue<CandidateResult> q)
Create a ResultSet from the specified queue of results
|
Modifier and Type | Method and Description |
---|---|
void |
addMetaItem(String name,
int docid,
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.
|
int[] |
getDocids()
Returns the documents ids after retrieval
|
int |
getExactResultSize()
Returns the exact size of the result set.
|
Lock |
getLock()
Returns the lock associated with the result set.
|
String |
getMetaItem(String name,
int docid)
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
|
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, with the given length.
|
int |
getResultSize()
Returns the effective size of the result set.
|
double[] |
getScores()
Returns the documents scores after retrieval
|
int |
getStatusCode()
Returns a status code for the 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 contain at least one query term.
|
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.
|
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 int resultSize
protected int exactResultSize
protected Lock lock
protected int statusCode
protected CandidateResultSet()
public CandidateResultSet(Queue<CandidateResult> q)
public CandidateResultSet(List<CandidateResult> q)
public Lock getLock()
public int getStatusCode()
getStatusCode
in interface ResultSet
public void setStatusCode(int _statusCode)
setStatusCode
in interface ResultSet
public void addMetaItem(String name, int docid, String value)
ResultSet
addMetaItem
in interface ResultSet
name
- the name of the metadata type. For example, it can be 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)
ResultSet
addMetaItems
in interface ResultSet
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 docid)
ResultSet
getMetaItem
in interface ResultSet
name
- the name of the metadata type.docid
- the document identifier of the document.public String[] getMetaItems(String name)
ResultSet
getMetaItems
in interface ResultSet
name
- the name of the metadata type.public boolean hasMetaItems(String name)
ResultSet
hasMetaItems
in interface ResultSet
name
- of the desired metaitem setpublic String[] getMetaKeys()
ResultSet
getMetaKeys
in interface ResultSet
public int[] getDocids()
ResultSet
public double[] getScores()
ResultSet
public short[] getOccurrences()
ResultSet
getOccurrences
in interface ResultSet
public int getResultSize()
ResultSet
getResultSize
in interface ResultSet
public int getExactResultSize()
ResultSet
getExactResultSize
in interface ResultSet
public ResultSet getResultSet(int start, int length)
getResultSet
in interface ResultSet
start
- the beginning of the subset.length
- the length of the subset.public ResultSet getResultSet(int[] positions)
ResultSet
getResultSet
in interface ResultSet
positions
- the list of elements in the current list that should be kept.public void initialise()
ResultSet
initialise
in interface ResultSet
public void initialise(double[] scs)
ResultSet
initialise
in interface ResultSet
scs
- double[] the scores to initiliase the result set with.public void setExactResultSize(int newExactResultSize)
ResultSet
setExactResultSize
in interface ResultSet
newExactResultSize
- int the effective size of the result set.public void setResultSize(int newResultSize)
ResultSet
setResultSize
in interface ResultSet
newResultSize
- int the effective size of the result set.public void sort()
ResultSet
Terrier 4.0. Copyright © 2004-2014 University of Glasgow