View Javadoc

1   // BSD License (http://www.galagosearch.org/license)
2   
3   package org.galagosearch.core.retrieval;
4   
5   /***
6    *
7    * @author trevor
8    */
9   public class ScoredDocument implements Comparable<ScoredDocument> {
10      public ScoredDocument(int document, double score) {
11          this.document = document;
12          this.score = score;
13      }
14  
15      public int compareTo(ScoredDocument other) {
16          if(score != other.score)
17              return Double.compare(score, other.score);
18          return other.document - document;
19      }
20      
21      public String toString() {
22          return String.format("%d,%f", document, score);
23      }
24  
25      public int document;
26      public double score;
27  }
28