mirror of https://github.com/apache/lucene.git
Remove generics for Comparable in FieldDoc again, because we have no type and <?> makes more problems than it helps
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@829319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ce4dd93a94
commit
519095db6e
|
@ -45,7 +45,7 @@ public class FieldDoc extends ScoreDoc {
|
|||
* @see Sort
|
||||
* @see Searcher#search(Query,Filter,int,Sort)
|
||||
*/
|
||||
public Comparable<?>[] fields;
|
||||
public Comparable[] fields;
|
||||
|
||||
/** Expert: Creates one of these objects with empty sort information. */
|
||||
public FieldDoc (int doc, float score) {
|
||||
|
@ -53,7 +53,7 @@ public class FieldDoc extends ScoreDoc {
|
|||
}
|
||||
|
||||
/** Expert: Creates one of these objects with the given sort information. */
|
||||
public FieldDoc (int doc, float score, Comparable<?>[] fields) {
|
||||
public FieldDoc (int doc, float score, Comparable[] fields) {
|
||||
super (doc, score);
|
||||
this.fields = fields;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class FieldDocSortedHitQueue extends PriorityQueue<FieldDoc> {
|
|||
* @param b ScoreDoc
|
||||
* @return <code>true</code> if document <code>a</code> should be sorted after document <code>b</code>.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("unchecked") @Override
|
||||
protected final boolean lessThan(final FieldDoc docA, final FieldDoc docB) {
|
||||
final int n = fields.length;
|
||||
int c = 0;
|
||||
|
@ -106,17 +106,17 @@ class FieldDocSortedHitQueue extends PriorityQueue<FieldDoc> {
|
|||
// null values need to be sorted first, because of how FieldCache.getStringIndex()
|
||||
// works - in that routine, any documents without a value in the given field are
|
||||
// put first. If both are null, the next SortField is used
|
||||
if (s1 == null) c = (s2==null) ? 0 : -1;
|
||||
else if (s2 == null) c = 1; //
|
||||
else if (fields[i].getLocale() == null) {
|
||||
if (s1 == null) {
|
||||
c = (s2 == null) ? 0 : -1;
|
||||
} else if (s2 == null) {
|
||||
c = 1;
|
||||
} else if (fields[i].getLocale() == null) {
|
||||
c = s1.compareTo(s2);
|
||||
} else {
|
||||
c = collators[i].compare(s1, s2);
|
||||
}
|
||||
} else {
|
||||
// the casts are a no-ops, its only there to make the
|
||||
// compiler happy because of unbounded generics:
|
||||
c = ((Comparable) docA.fields[i]).compareTo((Comparable) docB.fields[i]);
|
||||
c = docA.fields[i].compareTo(docB.fields[i]);
|
||||
if (type == SortField.SCORE) {
|
||||
c = -c;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue