You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by dn...@apache.org on 2004/08/10 23:34:57 UTC

cvs commit: jakarta-lucene/src/java/org/apache/lucene/document Field.java

dnaber      2004/08/10 14:34:57

  Modified:    src/java/org/apache/lucene/document Field.java
  Log:
  toString() now doesn't return "Keyword" etc anymore but prints "indexed, tokenized" etc. Information about termVectors is now also included.
  
  PR:28336
  
  Revision  Changes    Path
  1.15      +28 -16    jakarta-lucene/src/java/org/apache/lucene/document/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/document/Field.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Field.java	16 Apr 2004 09:48:25 -0000	1.14
  +++ Field.java	10 Aug 2004 21:34:57 -0000	1.15
  @@ -219,22 +219,34 @@
   
     /** 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();
     }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org