Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

toString() now doesn't return "Keyword" etc anymore but prints "indexed, tokenized" etc. Information about termVectors is now also included.

Daniel Naber453a317e1e14
diff --git a/src/java/org/apache/lucene/document/Field.java b/src/java/org/apache/lucene/document/Field.java
index b9aa1f18046..2bd5e5a3a7d 100644
--- a/src/java/org/apache/lucene/document/Field.java
+++ b/src/java/org/apache/lucene/document/Field.java
@@ -219,22 +219,34 @@ public final class Field implements java.io.Serializable {
/** Prints a Field for human consumption. */
public final String toString() {
- if (isStored && isIndexed && !isTokenized)
- return "Keyword<" + name + ":" + stringValue + ">";
- else if (isStored && !isIndexed && !isTokenized)
- return "Unindexed<" + name + ":" + stringValue + ">";
- else if (isStored && isIndexed && isTokenized && stringValue!=null)
- return "Text<" + name + ":" + stringValue + ">";
- else if (!isStored && isIndexed && isTokenized && readerValue!=null)
- return "Text<" + name + ":" + readerValue + ">";
- else if (!isStored && isIndexed && isTokenized)
- {
- return "UnStored<" + name + ">";
- }
- else
- {
- return super.toString();
- }
+ StringBuffer result = new StringBuffer();
+ if (isStored)
+ result.append("stored");
+ if (isIndexed) {
+ if (result.length() > 0)
+ result.append(",");
+ result.append("indexed");
+ }
+ if (isTokenized) {
+ if (result.length() > 0)
+ result.append(",");
+ result.append("tokenized");
+ }
+ if (storeTermVector) {
+ if (result.length() > 0)
+ result.append(",");
+ result.append("termVector");
+ }
+ result.append('<');
+ result.append(name);
+ result.append(':');
+ if (readerValue != null) {
+ result.append(readerValue.toString());
+ } else {
+ result.append(stringValue);
+ }
+ result.append('>');
+ return result.toString();
}
}