Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

revamp toString so as to not deal with potential IOException from fetching a document

Erik Hatcher6952e9664844
diff --git a/src/java/org/apache/lucene/search/Hit.java b/src/java/org/apache/lucene/search/Hit.java
index 586ab95482f..1e300b23477 100644
--- a/src/java/org/apache/lucene/search/Hit.java
+++ b/src/java/org/apache/lucene/search/Hit.java
@@ -108,18 +108,22 @@ public class Hit implements java.io.Serializable {
}
/**
- * Prints the fields of the underlying document for human consumption.
- * <p/>
- * If an IOException occurs whilst getting the document, returns null
- *
- * @see Document#toString()
+ * Prints the parameters to be used to discover the promised result.
*/
public String toString() {
- try {
- return getDocument().toString();
- } catch (IOException e) {
- return null;
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Hit<");
+ buffer.append(hits.toString());
+ buffer.append(" [");
+ buffer.append(hitNumber);
+ buffer.append("] ");
+ if (resolved) {
+ buffer.append("resolved");
+ } else {
+ buffer.append("unresolved");
}
+ buffer.append(">");
+ return buffer.toString();
}