org.terrier.matching
Class AccumulatorResultSet

java.lang.Object
  extended by org.terrier.matching.AccumulatorResultSet
All Implemented Interfaces:
java.io.Serializable, ResultSet

public class AccumulatorResultSet
extends java.lang.Object
implements ResultSet, java.io.Serializable

A result set instance that uses maps internally until initialise() is called

Since:
3.0
Author:
Nicola Tonelotto
See Also:
Serialized Form

Field Summary
protected  boolean arraysInitialised
           
 int[] docids
          docid[]
protected  int exactResultSize
           
protected  java.util.concurrent.locks.Lock lock
           
protected  boolean mapsInitialised
           
 short[] occurrences
          occurrences
 gnu.trove.TIntShortHashMap occurrencesMap
          occurrence map
protected  int resultSize
           
 double[] scores
          scores[]
 gnu.trove.TIntDoubleHashMap scoresMap
          score map
protected  int statusCode
           
 
Constructor Summary
AccumulatorResultSet(int numberOfDocuments)
          Constructs an instance of the AccumulatorResultSet
 
Method Summary
 void addMetaItem(java.lang.String name, int docid, java.lang.String value)
          Unsupported
 void addMetaItems(java.lang.String name, java.lang.String[] values)
          Unsupported
 AccumulatorResultSet getAccumulatorResultSet(int start, int length)
           
 int[] getDocids()
          Returns the documents ids after retrieval
 int getExactResultSize()
          Returns the exact size of the result set.
 java.util.concurrent.locks.Lock getLock()
          get lock
 java.lang.String getMetaItem(java.lang.String name, int docid)
          Unsupported
 java.lang.String[] getMetaItems(java.lang.String name)
          Unsupported
 java.lang.String[] getMetaKeys()
          Unsupported
 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()
          get status code
 boolean hasMetaItems(java.lang.String name)
          Unsupported
 void initialise()
          This method initialises the arrays to be sorted, after the matching phase has been completed
 void initialise(double[] scs)
          Unsupported
 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)
          set status code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

docids

public int[] docids
docid[]


scores

public double[] scores
scores[]


occurrences

public short[] occurrences
occurrences


arraysInitialised

protected boolean arraysInitialised

scoresMap

public gnu.trove.TIntDoubleHashMap scoresMap
score map


occurrencesMap

public gnu.trove.TIntShortHashMap occurrencesMap
occurrence map


mapsInitialised

protected boolean mapsInitialised

resultSize

protected int resultSize

exactResultSize

protected int exactResultSize

lock

protected java.util.concurrent.locks.Lock lock

statusCode

protected int statusCode
Constructor Detail

AccumulatorResultSet

public AccumulatorResultSet(int numberOfDocuments)
Constructs an instance of the AccumulatorResultSet

Parameters:
numberOfDocuments -
Method Detail

getLock

public java.util.concurrent.locks.Lock getLock()
get lock

Specified by:
getLock in interface ResultSet
Returns:
the lock.

getStatusCode

public int getStatusCode()
get status code

Specified by:
getStatusCode in interface ResultSet
Returns:
a integer status code. 0 stands success. 1 stands for empty result set. 2 stands for wrong setting of start/end parameters. 3 stands for query timeout. The values assigned to the status codes are increasing accordingly to the severity of the status.

setStatusCode

public void setStatusCode(int _statusCode)
set status code

Specified by:
setStatusCode in interface ResultSet

initialise

public void initialise()
This method initialises the arrays to be sorted, after the matching phase has been completed

Specified by:
initialise in interface ResultSet

initialise

public void initialise(double[] scs)
Unsupported

Specified by:
initialise in interface ResultSet
Parameters:
scs - double[] the scores to initiliase the result set with.

getDocids

public int[] getDocids()
Returns the documents ids after retrieval

Specified by:
getDocids in interface ResultSet

getResultSize

public int getResultSize()
Returns the effective size of the result set.

Specified by:
getResultSize in interface ResultSet
Returns:
int the effective size of the result set

getOccurrences

public short[] getOccurrences()
Returns the occurrences array.

Specified by:
getOccurrences in interface ResultSet
Returns:
int[] the array the occurrences array.

getExactResultSize

public int getExactResultSize()
Returns the exact size of the result set.

Specified by:
getExactResultSize in interface ResultSet
Returns:
int the exact size of the result set

getScores

public double[] getScores()
Returns the documents scores after retrieval

Specified by:
getScores in interface ResultSet

setResultSize

public void setResultSize(int newResultSize)
Sets the effective size of the result set, that is the number of documents to be sorted after retrieval.

Specified by:
setResultSize in interface ResultSet
Parameters:
newResultSize - int the effective size of the result set.

setExactResultSize

public 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.

Specified by:
setExactResultSize in interface ResultSet
Parameters:
newExactResultSize - int the effective size of the result set.

addMetaItem

public void addMetaItem(java.lang.String name,
                        int docid,
                        java.lang.String value)
Unsupported

Specified by:
addMetaItem in interface ResultSet
Parameters:
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.

addMetaItems

public void addMetaItems(java.lang.String name,
                         java.lang.String[] values)
Unsupported

Specified by:
addMetaItems in interface ResultSet
Parameters:
name - the name of the metadata type. For example, it can be url for adding the URLs of documents.
values - the metadata values.

getMetaItem

public java.lang.String getMetaItem(java.lang.String name,
                                    int docid)
Unsupported

Specified by:
getMetaItem in interface ResultSet
Parameters:
name - the name of the metadata type.
docid - the document identifier of the document.
Returns:
a string with the metadata information, or null of the metadata is not available.

getMetaItems

public java.lang.String[] getMetaItems(java.lang.String name)
Unsupported

Specified by:
getMetaItems in interface ResultSet
Parameters:
name - the name of the metadata type.
Returns:
an array of strings with the metadata information, or null of the metadata is not available.

hasMetaItems

public boolean hasMetaItems(java.lang.String name)
Unsupported

Specified by:
hasMetaItems in interface ResultSet
Parameters:
name - of the desired metaitem set
Returns:
true if the set exists.

getMetaKeys

public java.lang.String[] getMetaKeys()
Unsupported

Specified by:
getMetaKeys in interface ResultSet

getResultSet

public ResultSet getResultSet(int start,
                              int length)
Crops the existing result file and extracts a subset from the given starting point, with the given length.

Specified by:
getResultSet in interface ResultSet
Parameters:
start - the beginning of the subset.
length - the length of the subset.
Returns:
a subset of the current result set.

getResultSet

public 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.

Specified by:
getResultSet in interface ResultSet
Parameters:
positions - the list of elements in the current list that should be kept.
Returns:
a subset of the current result set specified by the list.

getAccumulatorResultSet

public AccumulatorResultSet getAccumulatorResultSet(int start,
                                                    int length)
See Also:
Returns a ResultSet starting at the pre-determined position, of the specified size.


Terrier 3.5. Copyright © 2004-2011 University of Glasgow