Class Relevance

java.lang.Object
com.yahoo.search.result.Relevance
All Implemented Interfaces:
Comparable<Relevance>

public class Relevance extends Object implements Comparable<Relevance>
A relevance double value. These values should ideally be normalized between 0 and 1 (where 1 means "perfect"), however this is not enforced.

Sources may create subclasses of this to include additional information or functionality.

Author:
bratseth
  • Constructor Summary

    Constructors
    Constructor
    Description
    Relevance(double score)
    Construct a relevancy object with an initial value.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares relevancy values with
    boolean
    equals(Object other)
    Compares relevancy values
    double
    Returns the relevancy score of this, preferably a normalized value between 0 and 1 but this is not guaranteed by this framework
    int
    Returns a hash from the relevancy value
    void
    setScore(double score)
    Set score value to this value.
    Returns the score value as a string

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Relevance

      public Relevance(double score)
      Construct a relevancy object with an initial value. This initial value should ideally be a normalized value between 0 and 1, but that is not enforced.
      Parameters:
      score - the initial value (rank score)
  • Method Details

    • setScore

      public void setScore(double score)
      Set score value to this value. This should ideally be a normalized value between 0 and 1, but that is not enforced. NaN is also a legal value, for elements where it makes no sense to assign a particular value.
    • getScore

      public double getScore()
      Returns the relevancy score of this, preferably a normalized value between 0 and 1 but this is not guaranteed by this framework
    • toString

      public String toString()
      Returns the score value as a string
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Relevance other)
      Compares relevancy values with
      Specified by:
      compareTo in interface Comparable<Relevance>
    • equals

      public boolean equals(Object other)
      Compares relevancy values
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash from the relevancy value
      Overrides:
      hashCode in class Object