ISSearch
Class ISPeerResult

java.lang.Object
  extended byISSearch.ISPeerResult
All Implemented Interfaces:
Comparable, ISPeerResultInterface, Serializable

public class ISPeerResult
extends Object
implements ISPeerResultInterface, Comparable

Sample class that implements the interface ISPeerResultInterface. This class represents the search result returned by the ISSearch search engine.

See Also:
Serialized Form

Field Summary
private  ISFeatureInterface[] features
          The array of document-specific features.
 int id
          The ID of this search result.
private static int maxID
          The max existing ID of search results.
private  double score
          The relevance (rank) of the document in the context of given query.
private  String URL
          The absolute URL of the documents as a String.
 
Constructor Summary
ISPeerResult()
           
 
Method Summary
 int compareTo(Object o)
          This function is required for the interface Comparable that is implemented by this object.
 ISFeatureInterface[] getFeatures()
          Returns the score (rank) of the document in the context of given query.
 double getScore()
          Returns the relevance of the document.
 String getURL()
          Returns the absolute URL of the documents as a String.
 void setFeatures(ISFeatureInterface[] f)
          Sets the array of document features.
 void setScore(double s)
          Sets the score (rank) of the document.
 void setURL(String u)
          Sets the absolute URL of the document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public int id
The ID of this search result. Internally used by the compareTo method to allow disamibiguation of equal-scored search results (e.g. when accessing them within Java Collections or Sets).


maxID

private static int maxID
The max existing ID of search results. Internally used by the compareTo method to allow disamibiguation of equal-scored search results (e.g. when accessing them within Java Collections or Sets).


features

private ISFeatureInterface[] features
The array of document-specific features. The features are pairs (term,weight) that are represented in our framework by objects that implement the interface ISFeatureInterface.

See Also:
ISFeatureInterface, ISFeature

URL

private String URL
The absolute URL of the documents as a String.


score

private double score
The relevance (rank) of the document in the context of given query. The relevance is used in our application scenario for ranked retrieval of query results; the best of them (e.g. top 10) are returned to the user. The document relevance is defined as the similarity between the document and the query (we use the scalar product between two feature vectors that represent the query and the document as the similarity metric).

Constructor Detail

ISPeerResult

public ISPeerResult()
Method Detail

getFeatures

public ISFeatureInterface[] getFeatures()
Returns the score (rank) of the document in the context of given query.

Specified by:
getFeatures in interface ISPeerResultInterface
Returns:
The score of the document in the context of given query.
See Also:
ISFeatureInterface, ISFeature

getScore

public double getScore()
Returns the relevance of the document.

Specified by:
getScore in interface ISPeerResultInterface
Returns:
The relevance of the document in the context of given query.

getURL

public String getURL()
Returns the absolute URL of the documents as a String.

Specified by:
getURL in interface ISPeerResultInterface
Returns:
The absolute URL of the document as string object.

setFeatures

public void setFeatures(ISFeatureInterface[] f)
Sets the array of document features.

Parameters:
f - The new array of document features.

setURL

public void setURL(String u)
Sets the absolute URL of the document.

Parameters:
u - The absolute URL of the document as a String.

setScore

public void setScore(double s)
Sets the score (rank) of the document.

Parameters:
s - The new score of the document as double value.

compareTo

public int compareTo(Object o)
This function is required for the interface Comparable that is implemented by this object. The objects that implement the interface Comparable can be automatically sorted using built-in Java functions. Note that Java sorts object in ascending order (lower values first). To obtain items sorted in descending order (higher values first), we need to invert the outcome of the compareto function as shown in this sample class.

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.