DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28336>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28336

Field.toString could be more helpful

           Summary: Field.toString could be more helpful
           Product: Lucene
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Index
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


org.apache.lucene.document.Field.toString defaults to using Object.toString
for some sensible fields. e.g. !isStored && isIndexed && !isTokenized
fields. This makes debugging slightly more difficult than is really needed.

Please find pasted below possible alternative:

 /** Prints a Field for human consumption. */
  public final String toString() {
        StringBuffer result = new StringBuffer();
        if (isStored) {
                if (isIndexed) {
                        if (isTokenized) {
                                result.append("Text");
                        } else {
                                result.append("Keyword");
                        }
                } else {
                        // XXX warn on tokenized not indexed?
                        result.append("Unindexed");
                }
        } else {
                if (isIndexed) {
                        if (isTokenized) {
                                result.append("Unstored");
                        } else {
                                result.append("UnstoredUntokenized");
                        }
                } else {
                        result.append("Nonsense_UnstoredUnindexed");
                }
        }
        
        result.append('<');
        result.append(name);
        result.append(':');
        if (readerValue != null) {
                result.append(readerValue.toString());
        } else {
                result.append(stringValue);
        }
        result.append('>');
        return result.toString();
  }


NB Im working against CVS HEAD

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to