1 package org.apache.lucene.search; 2 3 18 19 20 29 public interface ScoreDocComparator { 30 31 32 static final ScoreDocComparator RELEVANCE = new ScoreDocComparator() { 33 public int compare (ScoreDoc i, ScoreDoc j) { 34 if (i.score > j.score) return -1; 35 if (i.score < j.score) return 1; 36 return 0; 37 } 38 public Comparable sortValue (ScoreDoc i) { 39 return new Float (i.score); 40 } 41 public int sortType() { 42 return SortField.SCORE; 43 } 44 }; 45 46 47 48 static final ScoreDocComparator INDEXORDER = new ScoreDocComparator() { 49 public int compare (ScoreDoc i, ScoreDoc j) { 50 if (i.doc < j.doc) return -1; 51 if (i.doc > j.doc) return 1; 52 return 0; 53 } 54 public Comparable sortValue (ScoreDoc i) { 55 return new Integer (i.doc); 56 } 57 public int sortType() { 58 return SortField.DOC; 59 } 60 }; 61 62 63 71 int compare (ScoreDoc i, ScoreDoc j); 72 73 74 82 Comparable sortValue (ScoreDoc i); 83 84 85 92 int sortType(); 93 } | Popular Tags |