com.sun.labs.minion
Interface Result

All Superinterfaces:
java.lang.Comparable<Result>
All Known Implementing Classes:
ResultImpl

public interface Result
extends java.lang.Comparable<Result>

A class that holds a single search result.


Method Summary
 double getDistance(Result r, java.lang.String name)
          Gets the distance between this result and another based on a named feature vector value.
 Document getDocument()
          Gets a document abstraction for the document in this result.
 DocumentVector getDocumentVector()
          Gets a document vector corresponding to the document in this result.
 DocumentVector getDocumentVector(java.lang.String field)
          Gets a document vector corresponding to a particluar vectored field in the document in this result.
 DocumentVector getDocumentVector(WeightedField[] fields)
          Gets a composite document vector that corresponds to a linear combination of a number of vectored fields in the document in this result.
 java.util.List getField(java.lang.String name)
          Gets the values of a saved field for the document.
 java.util.Iterator getFieldIterator()
          Returns an iterator for all of the field values in a result.
 java.lang.String getIndexName()
          Gets the name of the index that this result was drawn from.
 java.lang.String getKey()
          Gets the document key associated with the document represented by this result.
 int getNPassages()
          Gets the number of passages associated with this result.
 PassageBuilder getPassageBuilder()
          Gets a passage builder that can be used to construct passages for display from this result.
 float getScore()
          Gets the score associated with this result.
 java.lang.Object getSingleFieldValue(java.lang.String name)
          Gets a single value of a saved field for the document.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getKey

java.lang.String getKey()
Gets the document key associated with the document represented by this result.

Returns:
the key for the document represented by this result

getField

java.util.List getField(java.lang.String name)
Gets the values of a saved field for the document.

Parameters:
name - The name of the field for which we want the saved values.
Returns:
A list containing objects of the appropriate type for the named field. If the field is not defined as a saved field, or if there was no value stored for this result, then an empty list is returned.

getSingleFieldValue

java.lang.Object getSingleFieldValue(java.lang.String name)
Gets a single value of a saved field for the document.

Parameters:
name - The name of the field for which we want the saved values.
Returns:
An object of the appropriate type for the named field. If multiple values are stored for the named field, no guarantee is made about which of the multiple values are returned. If the given name does not name a saved field or if there was no data stored for that field, then null is returned.

getDocument

Document getDocument()
Gets a document abstraction for the document in this result.

Returns:
the document abstraction corresponding to this result.

getDocumentVector

DocumentVector getDocumentVector()
Gets a document vector corresponding to the document in this result.

Returns:
the document vector for the document represented by this result

getDocumentVector

DocumentVector getDocumentVector(java.lang.String field)
Gets a document vector corresponding to a particluar vectored field in the document in this result.

Parameters:
field - the name of a vectored field upon which the clustering should be based. A value of null indicates that all vectored fields should be considered, while an empty string indicates that data in no explicit field should be considered.
Returns:
the document vector for this document where the terms in the vector are those found only in the given field. Note that the document vector returned cannot be used in conjunction with a composite document vector.
See Also:
getDocumentVector(WeightedField[])

getDocumentVector

DocumentVector getDocumentVector(WeightedField[] fields)
Gets a composite document vector that corresponds to a linear combination of a number of vectored fields in the document in this result. The linear combination of the components of the document vector is described by the weighted fields provided. While not an absolute necessity, if the weights of the fields do not sum to 1, you may get a document vector with weights greater than 1.

Parameters:
fields - the fields that we will be using to build the document vector
Returns:
the composite document vector for this document where the terms in the vector are those found in any of the provided fields. Note that the document vector returned cannot be used in conjunction with a non-composite document vector!
See Also:
getDocumentVector(String)

getFieldIterator

java.util.Iterator getFieldIterator()
Returns an iterator for all of the field values in a result.

Returns:
an iterator for all of the field values in a result

getScore

float getScore()
Gets the score associated with this result.

Returns:
the score associated with this result

getDistance

double getDistance(Result r,
                   java.lang.String name)
Gets the distance between this result and another based on a named feature vector value.

Parameters:
r - the other result
name - the name of the feature vector field
Returns:
the euclidean distance between the two results based on the give field.

getNPassages

int getNPassages()
Gets the number of passages associated with this result.

Returns:
the number of passages associated with this result.

getIndexName

java.lang.String getIndexName()
Gets the name of the index that this result was drawn from. This is a configuration parameter that is passed to the SearchEngine at startup time.

Returns:
the name of the index from which this result was drawn

getPassageBuilder

PassageBuilder getPassageBuilder()
Gets a passage builder that can be used to construct passages for display from this result.

Returns:
a passage builder that we can use to construct passages for this result