mirror of https://github.com/apache/lucene.git
handy toString methods for the new Sort classes. feel free to adjust the aesthetics
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7176a6a488
commit
6e7df0fa69
|
@ -202,4 +202,16 @@ implements Serializable {
|
|||
public void setSort (SortField[] fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
buffer.append(fields[i].toString());
|
||||
if ((i +1) < fields.length)
|
||||
buffer.append(',');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,4 +133,22 @@ implements Serializable {
|
|||
public boolean getReverse() {
|
||||
return reverse;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
switch (type) {
|
||||
case SCORE: buffer.append("<score>");
|
||||
break;
|
||||
|
||||
case DOC: buffer.append("<doc>");
|
||||
break;
|
||||
|
||||
default: buffer.append("\"" + field + "\"");
|
||||
break;
|
||||
}
|
||||
|
||||
buffer.append(reverse ? " DESC" : " ASC");
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue